@popcorn245/cornfield 0.54.0 → 0.56.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/contrast.js +28 -0
- package/core/schema.js +24 -0
- package/explorer/css/page.css +0 -8
- package/explorer/css/work.css +3 -26
- package/explorer/deep-link.js +11 -24
- package/explorer/engine/layers.js +5 -2
- package/explorer/engine/map-style.js +8 -1
- package/explorer/engine/render.js +2 -1
- package/explorer/forge-panel-model.js +2 -36
- package/explorer/forge-panel.js +3 -7
- package/explorer/index.html +5 -11
- package/explorer/instance-state.js +0 -6
- package/explorer/instance.js +9 -5
- package/explorer/layer-model.js +1 -0
- package/explorer/page.js +8 -5
- package/explorer/pieces/layers.js +1 -1
- package/explorer/pieces/node-panel.js +26 -4
- package/explorer/pieces/search.js +9 -3
- package/explorer/pieces/work-agent.js +3 -2
- package/explorer/pieces/work-common.js +14 -15
- package/explorer/pieces/work-confirm.js +11 -10
- package/explorer/pieces/work-data.js +24 -31
- package/explorer/pieces/work-deploys.js +42 -41
- package/explorer/pieces/work-issues.js +32 -29
- package/explorer/pieces/work-list.js +406 -0
- package/explorer/pieces/work-markup.js +9 -15
- package/explorer/pieces/work-notes.js +0 -1
- package/explorer/pieces/work-paint.js +57 -67
- package/explorer/pieces/work-prs.js +25 -66
- package/explorer/pieces/work-runs.js +47 -57
- package/explorer/pieces/work-specs.js +19 -2
- package/explorer/pieces/work-threads.js +29 -49
- package/explorer/pieces/work.js +28 -28
- package/explorer/proposal-model.js +5 -5
- package/explorer/runs-view.js +10 -18
- package/explorer/scene.js +17 -10
- package/explorer/search-match.js +3 -2
- package/explorer/tokens.css +11 -0
- package/explorer/view.js +8 -1
- package/explorer/waiting-view.js +3 -3
- package/explorer/work-model.js +722 -0
- package/explorer/work-view.css +50 -0
- package/explorer/work-view.js +570 -0
- package/package.json +1 -1
- package/explorer/pieces/work-events.js +0 -285
|
@@ -212,12 +212,12 @@ export function mergeSpecs(entries) {
|
|
|
212
212
|
* One row: title, a pill that says its review state (To decide, Changed since approved, Sent back, Approved, Draft PR, Local, spec 0010 D4),
|
|
213
213
|
* who and when beside it ("Approved by maintainer-one \u00b7 2 hours ago", "Waiting 2 days"), a line of what it is for, and the meta (spec number,
|
|
214
214
|
* where it is, +added ~changed \u2212removed, scenarios). A review that could not be read says so, with a way to try again, and never looks
|
|
215
|
-
* unreviewed. A proposal that could not be read is a row that says why and opens nothing.
|
|
215
|
+
* unreviewed. A proposal that could not be read is a row that says why and opens nothing. A row selects the proposal's node (`data-work-ref`: work-list.js); the review is opened from the node panel.
|
|
216
216
|
* What the forge said (a login, a date) is escaped; the pill's state is one of a fixed list.
|
|
217
217
|
* @param {{ slug: string, source: string, title?: string, summary?: string, spec?: string, pull?: {number: number, draft?: boolean}, review?: object | null, counts?: {added?: number, changed?: number, removed?: number, scenarios?: number}, errors?: number, error?: string }} entry
|
|
218
|
-
* @param {{
|
|
218
|
+
* @param {{ shown?: string | null, nowMs?: number }} [opts] the row the node panel shows now (`proposal:<slug>`); the clock
|
|
219
219
|
*/
|
|
220
|
-
export function specRowHtml(entry, {
|
|
220
|
+
export function specRowHtml(entry, { shown = null, nowMs = Date.now() } = {}) {
|
|
221
221
|
const head = `<span class="hx-forge-title">${escHtml(entry.title || entry.slug)}</span>`;
|
|
222
222
|
if (entry.error) {
|
|
223
223
|
return `<li class="hx-forge-item"><div class="hx-forge-row hx-forge-spec" data-corn="row">${head}<span class="hx-forge-sum hx-error-text">${escHtml(entry.error)}</span><span class="hx-forge-meta">${escHtml(specWhere(entry))}</span></div></li>`;
|
|
@@ -237,9 +237,9 @@ export function specRowHtml(entry, { current = null, nowMs = Date.now() } = {})
|
|
|
237
237
|
c.scenarios ? `<span>${c.scenarios} ${c.scenarios === 1 ? 'scenario' : 'scenarios'}</span>` : '',
|
|
238
238
|
entry.errors ? `<span class="hx-warn">${entry.errors} ${entry.errors === 1 ? 'problem' : 'problems'}</span>` : '',
|
|
239
239
|
].filter(Boolean).join('');
|
|
240
|
-
const mine =
|
|
240
|
+
const mine = shown === `proposal:${entry.slug}`;
|
|
241
241
|
const unread = state === 'unknown' ? `<p class="hx-forge-meta hx-forge-unread" data-corn="message" data-corn-state="failure">${escHtml(entry.review && entry.review.error ? entry.review.error : 'The forge could not be asked.')} <button type="button" class="hx-btn hx-forge-act" data-corn-kind="quiet" data-action="retry-forge" aria-label="Try again: ${escHtml(entry.title || entry.slug)}">Try again</button></p>` : '';
|
|
242
|
-
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row hx-forge-spec" data-
|
|
242
|
+
return `<li class="hx-forge-item"><button type="button" class="hx-forge-row hx-forge-spec" data-work-ref="proposal:${escHtml(entry.slug)}" aria-pressed="${mine}" data-corn="row">`
|
|
243
243
|
+ `<span class="hx-forge-line">${head}${pill}</span>`
|
|
244
244
|
+ `${entry.summary ? `<span class="hx-forge-sum">${escHtml(entry.summary)}</span>` : ''}<span class="hx-forge-meta hx-forge-facts">${meta}</span></button>${unread}</li>`;
|
|
245
245
|
}
|
package/explorer/runs-view.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { relativeTime } from './review-model.js';
|
|
12
|
-
import { runTone, canRetry, aboutWords, runName, statusWords, statusWhy, runMeta, canStop, canAnswer,
|
|
12
|
+
import { runTone, canRetry, aboutWords, runName, statusWords, statusWhy, runMeta, canStop, canAnswer, limitRows, checksWords, timelineWords, nodeLabels, collisionWords, answerWords } from './runs-model.js';
|
|
13
13
|
import { cornState, cornStateAttr, stateIconHtml } from './corn-state.js';
|
|
14
14
|
import { t } from './strings.js';
|
|
15
15
|
import { runGroups } from './waiting-model.js';
|
|
@@ -25,7 +25,6 @@ import { runGroupHeadingHtml } from './waiting-view.js';
|
|
|
25
25
|
* @property {string} forgeType 'github' | 'forgejo'
|
|
26
26
|
* @property {number} now
|
|
27
27
|
* @property {{ id: string, label?: string }[]} nodes the map's nodes, for names
|
|
28
|
-
* @property {string | null} selected the run lit on the map
|
|
29
28
|
* @property {Set<string>} timelines the runs whose timeline is open
|
|
30
29
|
* @property {boolean} busy an action is in flight
|
|
31
30
|
* @property {Map<string, string>} [replies] the reply typed so far for each waiting run, so a repaint keeps it
|
|
@@ -143,7 +142,6 @@ export function loadingLinesHtml(n = 1) {
|
|
|
143
142
|
/** One run */
|
|
144
143
|
export function runHtml(ctx, run, all) {
|
|
145
144
|
const say = ctx.t || t;
|
|
146
|
-
const lit = ctx.selected === run.runId;
|
|
147
145
|
const open = ctx.timelines.has(run.runId);
|
|
148
146
|
const why = statusWhy(run);
|
|
149
147
|
const name = ctx.esc(runName(run, ctx.now));
|
|
@@ -157,8 +155,6 @@ export function runHtml(ctx, run, all) {
|
|
|
157
155
|
const limits = limitRows(run);
|
|
158
156
|
const count = (run.timeline || []).length;
|
|
159
157
|
const links = linksHtml(ctx, run);
|
|
160
|
-
const noNodes = !(run.nodes || []).length;
|
|
161
|
-
const lightWords = lit ? 'Lit on the map' : 'Light on the map';
|
|
162
158
|
const result = resultHtml(ctx, run);
|
|
163
159
|
return `<li class="hx-run hx-forge-file" data-run="${ctx.esc(run.runId)}" tabindex="-1" data-corn="run"${cornStateAttr(run.status)}>
|
|
164
160
|
<div class="hx-run-head">${runPillHtml(ctx, run, statusWords(run))} <span class="hx-name">${ctx.esc(run.kind)} on ${ctx.esc(aboutWords(run.refs))}</span>${run.profile ? ` <span class="hx-faint">profile ${ctx.esc(run.profile)}</span>` : ''}</div>
|
|
@@ -171,25 +167,21 @@ export function runHtml(ctx, run, all) {
|
|
|
171
167
|
${links ? `<p class="hx-forge-meta">${links}</p>` : ''}
|
|
172
168
|
${answering ? `${answerHtml(ctx, run)}${result}` : unsentHtml(ctx, run)}${run.answer && !answering ? answeredHtml(ctx, run) : ''}
|
|
173
169
|
<div class="hx-run-actions" data-corn="run-actions">${stop}${retry}
|
|
174
|
-
<button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-select="${ctx.esc(run.runId)}" aria-pressed="${lit}" aria-label="${lightWords}: ${name}"${noNodes ? ` disabled title="No node on the map yet, so there is nothing to light" aria-describedby="run-nodes-${ctx.esc(run.runId)}"` : ''}>${lightWords}</button>
|
|
175
170
|
<button data-corn-kind="secondary" type="button" class="hx-btn hx-forge-act" data-run-timeline="${ctx.esc(run.runId)}" aria-expanded="${open}" aria-controls="run-tl-${ctx.esc(run.runId)}">Timeline (${count})</button></div>
|
|
176
171
|
${answering ? '' : result}
|
|
177
172
|
${open ? timelineHtml(ctx, run, all) : ''}</li>`;
|
|
178
173
|
}
|
|
179
174
|
|
|
180
175
|
/**
|
|
181
|
-
* The list, in groups (spec 0010 D6): Needs you (oldest question first), In motion, Finished (each newest first), each starting with a heading that
|
|
182
|
-
* says how many
|
|
183
|
-
* @param {ViewContext} ctx
|
|
176
|
+
* The Runs list of the Work list, in groups (spec 0010 D6): Needs you (oldest question first), In motion, Finished (each newest first), each starting with a heading that
|
|
177
|
+
* says how many. A row is a button that selects the run's node (work-list.js); the card, with its answer field, is the node panel's (`runHtml`).
|
|
178
|
+
* @param {ViewContext & { shown?: string | null }} ctx `shown`: the run the node panel has now
|
|
184
179
|
* @param {object[]} runs
|
|
185
180
|
*/
|
|
186
|
-
export function
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<p class="hx-forge-meta hx-faint">The same request under each profile, side by side.</p>
|
|
193
|
-
<ul class="hx-run-columns" aria-label="${ctx.esc(g.runs.length)} profiles compared">${g.runs.map((r) => runHtml(ctx, r, runs)).join('')}</ul></section></li>`;
|
|
194
|
-
}).join('')).join('');
|
|
181
|
+
export function runRowsHtml(ctx, runs) {
|
|
182
|
+
const say = ctx.t || t;
|
|
183
|
+
const row = (run) => `<li class="hx-forge-item" data-key="${ctx.esc(run.runId)}"><button type="button" class="hx-forge-row" data-work-ref="run:${ctx.esc(run.runId)}" aria-pressed="${ctx.shown === run.runId}" data-corn="row"${cornStateAttr(run.status)}>
|
|
184
|
+
<span class="hx-forge-title">${ctx.esc(run.kind)} on ${ctx.esc(aboutWords(run.refs))}</span>
|
|
185
|
+
<span class="hx-forge-meta">${runPillHtml(ctx, run, statusWords(run))} ${ctx.esc(runMeta(run, ctx.now))}</span></button></li>`;
|
|
186
|
+
return runGroups(runs).map((group) => runGroupHeadingHtml(group, say) + group.items.flatMap((g) => (g.kind === 'run' ? [g.run] : g.runs)).map(row).join('')).join('');
|
|
195
187
|
}
|
package/explorer/scene.js
CHANGED
|
@@ -174,9 +174,9 @@ import { paintVerdict } from './verdict-paint.js';
|
|
|
174
174
|
import { externalLayer, whenTicks } from './cloud-model.js';
|
|
175
175
|
import { greying, lettersOf, projectLayerKey, shownByProposal, layersOf } from './layer-model.js';
|
|
176
176
|
import { NODE_THEMES, shapeOf } from '../core/schema.js';
|
|
177
|
+
import { WORK_KINDS } from '../core/schema.js';
|
|
177
178
|
import { hasGlyph } from './glyphs.js';
|
|
178
179
|
import { outageFor, paintOutage } from './outage-model.js';
|
|
179
|
-
import { paintForge } from './forge-panel-model.js';
|
|
180
180
|
import { lightColor, lightenScene, parseColor } from './theme-model.js';
|
|
181
181
|
import { matchIds } from './search-match.js';
|
|
182
182
|
import { nodeColor } from './css-color.js';
|
|
@@ -287,6 +287,7 @@ export { GREY_ALPHA }; // how much of a greyed node is left (diff-marks.js): its
|
|
|
287
287
|
*/
|
|
288
288
|
export function isNodeVisible(state, node, { viewer = false } = {}) {
|
|
289
289
|
if (state.proposal && !showsNode(state.proposalView || 'diff', node)) return false; // Before hides what is added, After what is removed
|
|
290
|
+
if (state.view === 'work') return node.hidden !== true; // the Work view (spec 0012): its layers set `hidden` on the nodes (work-view.js)
|
|
290
291
|
if (state.view === 'dataflow') return !!state.flow && state.flow.ids.has(node.id);
|
|
291
292
|
if (state.view === 'house') return houseShowsNode(state, node); // the House view (spec 0029, PHY-11) draws its own set: house-model.js
|
|
292
293
|
if (node.type === 'root') return true;
|
|
@@ -498,6 +499,7 @@ function buildEdges(state, subgraph, reduceMotion) {
|
|
|
498
499
|
const target = byId.get(edge.to);
|
|
499
500
|
if (!source || !target || !isNodeVisible(state, source) || !isNodeVisible(state, target)) return;
|
|
500
501
|
|
|
502
|
+
if (state.view === 'work') { out.push(state.workEdge(edge, source, target, subgraph ? subgraph.connectedEdgeKeys.has(focusKey(edge)) : true, !!subgraph, edgeKeyOf(edge), { PROPOSED_DASH, USAGE_DASH }, state.workEdgeColors)); return; } // the Work view's lines are work-model.js's (the page installs `workEdge`)
|
|
501
503
|
if (preset) return flow(edge, source, target);
|
|
502
504
|
if (state.view === 'house') { const how = houseEdgeStyle(edge, source, target); if (how === 'flow') flow(edge, source, target); else if (how === 'link') out.push(linkEdge(edge, source, target, subgraph)); return; }
|
|
503
505
|
|
|
@@ -581,27 +583,32 @@ function buildNodes(state, subgraph) {
|
|
|
581
583
|
const selected = !!selectedNode && selectedNode.id === node.id;
|
|
582
584
|
const connected = subgraph ? subgraph.connectedNodeIds.has(node.id) : true;
|
|
583
585
|
const child = subgraph && subgraph.childIds ? subgraph.childIds.has(node.id) : false;
|
|
584
|
-
const mark = view ? markIn(view, node) : 'none';
|
|
586
|
+
const mark = node.planned === true ? 'added' : view ? markIn(view, node) : 'none'; // a node a proposal adds that the map does not hold yet is drawn as planned (spec 0012 D2)
|
|
585
587
|
const look = MARK[mark];
|
|
586
588
|
const gone = mark === 'edit' && node.editOp === 'removed'; // a node a what-if edit removes: violet ring, faded, label struck through
|
|
587
589
|
// deep dimming for what is not connected; a proposal's Diff view fades what it does not touch, less deeply, and a removed node is faded too
|
|
588
590
|
// A search's matches are what the reader asked for: a selection's focus does not dim them, so each keeps its label (spec 0008 D4)
|
|
589
|
-
|
|
590
|
-
|
|
591
|
+
const dimmed = state.view === 'work' ? PROPOSAL_DIM_ALPHA : DIM_ALPHA; // the Work view dims to what the mock shows: the rest is still readable
|
|
592
|
+
let alpha = subgraph && !connected && !(searching && match) ? dimmed : 1;
|
|
593
|
+
if (searching && !match && !selected && !(subgraph && connected)) alpha = dimmed; // a search dims what it did not find, as a focus does
|
|
594
|
+
if (node.dim === true) alpha = Math.min(alpha, dimmed); // "Waiting on you" (work-view.js)
|
|
591
595
|
const greyed = grey && !!focus && !focus.touched.has(node.id);
|
|
592
596
|
if (focus && !focus.touched.has(node.id)) alpha = Math.min(alpha, greyed ? GREY_ALPHA : PROPOSAL_DIM_ALPHA);
|
|
593
597
|
if (look) alpha *= gone ? MARK.removed.alpha : look.alpha;
|
|
594
598
|
const big = shown.type === 'root' || shown.type === 'app';
|
|
595
599
|
// A finer kind (spec 0009): its letters, drawn in the node's core by the renderers (kind-letters.js), and the project layer that takes the node
|
|
596
|
-
const
|
|
600
|
+
const work = WORK_KINDS.includes(shown.work) ? shown.work : ''; // a kind of work carries its own shape and letters (work-model.js)
|
|
601
|
+
const shape = work && Object.hasOwn(SHAPE_REACH, shown.shape) ? shown.shape : shapeOf(shown.type);
|
|
602
|
+
const letters = work ? String(shown.letters || '') : lettersOf(state, shown);
|
|
597
603
|
const layer = projectLayerKey(state, shown);
|
|
598
604
|
|
|
599
605
|
out.push({
|
|
600
606
|
id: node.id, type: shown.type, group: groupOf(shown),
|
|
601
607
|
...(typeof shown.kind === 'string' && shown.kind ? { kind: shown.kind } : {}),
|
|
602
608
|
...(letters ? { letters } : {}),
|
|
603
|
-
|
|
604
|
-
|
|
609
|
+
...(work ? { work } : {}), // a kind of work (the Work view): its colour is its own token (map-style.js)
|
|
610
|
+
shape, // the silhouette of the node's family (spec 0008 D8): circle, rounded-square, hexagon, square, diamond
|
|
611
|
+
hitR: shown.r * SHAPE_REACH[shape], // the disc a click or tap hits: as far as the silhouette reaches (spatial.js)
|
|
605
612
|
...(hasGlyph(shown.type) ? { glyph: shown.type } : {}), // its built-in glyph, drawn where the core dot is once the node is wide enough (glyphs.js)
|
|
606
613
|
...(layer ? { layer } : {}),
|
|
607
614
|
x: node.x, y: node.y, r: shown.r, color: fillOfNode(shown),
|
|
@@ -612,13 +619,13 @@ function buildNodes(state, subgraph) {
|
|
|
612
619
|
...(greyed ? { greyed: true } : {}), // not involved in the change: its colour is taken away at draw time, glyph and letters stay (map-style.js)
|
|
613
620
|
selected, match, current, connected,
|
|
614
621
|
degree: node.degree || 0,
|
|
615
|
-
label: shown.label,
|
|
622
|
+
label: shown.labelText || shown.label, // a node of the Work view is drawn as the start of its name; the whole of it is the node panel's (work-model.js)
|
|
616
623
|
labelSize: big && !greyed ? 12 : 11, // a greyed node's label recedes (issue #232): plain, at the least size, placed last (labels.js)
|
|
617
624
|
labelBold: big && !greyed,
|
|
618
625
|
labelAlpha: greyed && !(subgraph && !connected) ? GREY_LABEL_ALPHA[state.theme === 'light' ? 'light' : 'dark'] // a greyed node's label: at the dimmed-label floor on either ground
|
|
619
626
|
: focus && !focus.touched.has(node.id) && !(subgraph && !connected) ? Math.max(alpha, DIFF_LABEL_ALPHA) : alpha, // a label the diff dims stays 3:1
|
|
620
627
|
labelColor: connected ? '#f8fafc' : 'rgba(255, 255, 255, 0.3)',
|
|
621
|
-
labelKeep: (LANDMARK_TYPES.includes(shown.type) && !greyed) || selected || match || mark !== 'none' || !!(subgraph && connected),
|
|
628
|
+
labelKeep: (LANDMARK_TYPES.includes(shown.type) && !greyed) || (!!work && shown.waiting === true) || selected || match || mark !== 'none' || !!(subgraph && connected),
|
|
622
629
|
labelStrike: !!look && (look.strike || gone),
|
|
623
630
|
live: !!node.live,
|
|
624
631
|
box: node.box || null,
|
|
@@ -744,12 +751,12 @@ export function buildScene(state, opts = {}) {
|
|
|
744
751
|
version: state.sceneVersion || 0,
|
|
745
752
|
};
|
|
746
753
|
if (state.view === 'house') decorateHouseScene(scene, state); // its bands and tray as lanes, rooms unlabelled (house-model.js)
|
|
754
|
+
if (state.view === 'work' && state.workLanes) scene.decor.lanes = state.workLanes; // its lanes and their titles (work-model.js)
|
|
747
755
|
if (state.scenario) emphasiseScenario(scene, state.scenario, opts);
|
|
748
756
|
scene.greying = scene.nodes.some((n) => n.greyed) || scene.edges.some((e) => e.greyed);
|
|
749
757
|
const colours = { nodes: scene.nodes.map((n) => n.color), edges: scene.edges.map((e) => e.color) };
|
|
750
758
|
if (state.scenario) paintOutage(scene, outageFor(state.scenario, state.nodes, state.edges)); // CLOUD-07: red, amber, violet by when the outage bites
|
|
751
759
|
if (state.scenario) paintVerdict(scene, state.scenario); // PHY-10: red, green or amber by the step's permission check
|
|
752
|
-
if (state.forgeLit) paintForge(scene, state.forgeLit); // CF-07: the selected pull request's nodes, the rest faded
|
|
753
760
|
// The nodes and edges a painter above gave a colour: the map's own styling (map-style.js) leaves them to it
|
|
754
761
|
scene.nodes.forEach((n, i) => { if (colours.nodes.length === scene.nodes.length && n.color !== colours.nodes[i]) scene.painted.nodes.add(n.id); });
|
|
755
762
|
scene.edges.forEach((e, i) => { if (colours.edges.length === scene.edges.length && e.color !== colours.edges[i]) scene.painted.edges.add(e.key); });
|
package/explorer/search-match.js
CHANGED
|
@@ -21,7 +21,7 @@ export const TYPE_NAMES = Object.freeze({
|
|
|
21
21
|
const capital = (s) => (s ? s.charAt(0).toUpperCase() + s.slice(1) : s);
|
|
22
22
|
|
|
23
23
|
/** The name of the group a node is listed under: its layer's name */
|
|
24
|
-
export const groupName = (node) => TYPE_NAMES[node.type] || capital(String(node.type || ''));
|
|
24
|
+
export const groupName = (node) => (typeof node.groupName === 'string' && node.groupName) || TYPE_NAMES[node.type] || capital(String(node.type || '')); // a piece of work names its own group (the Work view)
|
|
25
25
|
|
|
26
26
|
const lower = (s) => (typeof s === 'string' ? s.toLowerCase() : '');
|
|
27
27
|
const WORD_BREAK = /[^\p{L}\p{N}]+/u;
|
|
@@ -38,7 +38,8 @@ export function rankOf(node, query) {
|
|
|
38
38
|
if (label.startsWith(term)) return RANK.labelStart;
|
|
39
39
|
if (label.split(WORD_BREAK).some((w) => w && w.startsWith(term))) return RANK.wordStart;
|
|
40
40
|
if (label.includes(term)) return RANK.label;
|
|
41
|
-
if (
|
|
41
|
+
if (Array.isArray(node.terms) && node.terms.some((x) => lower(x) === term)) return RANK.labelStart; // what a piece of work is also called: `#21`, `pr 21`, its slug (the Work view)
|
|
42
|
+
if (lower(node.id).includes(term) || lower(node.file).includes(term) || (Array.isArray(node.terms) && node.terms.some((x) => lower(x).includes(term)))) return RANK.idOrFile;
|
|
42
43
|
if (lower(node.type).includes(term) || lower(groupName(node)).includes(term) || lower(node.kind).includes(term)) return RANK.typeOrKind;
|
|
43
44
|
return -1;
|
|
44
45
|
}
|
package/explorer/tokens.css
CHANGED
|
@@ -192,6 +192,17 @@
|
|
|
192
192
|
--corn-map-node-device: auto;
|
|
193
193
|
--corn-map-node-floor: auto;
|
|
194
194
|
--corn-map-node-room: auto;
|
|
195
|
+
/* The Work view's nodes (spec 0012 D2): the fill of each kind of work; auto is the kind's own colour (core/schema.js WORK_THEMES) */
|
|
196
|
+
--corn-work-thread: auto;
|
|
197
|
+
--corn-work-issue: auto;
|
|
198
|
+
--corn-work-proposal: auto;
|
|
199
|
+
--corn-work-run: auto;
|
|
200
|
+
--corn-work-pull: auto;
|
|
201
|
+
--corn-work-deploy: auto;
|
|
202
|
+
/* …and its lines: a link between work, a link to code, and what a proposal adds (core/schema.js WORK_EDGE_THEMES) */
|
|
203
|
+
--corn-work-edge-work: auto;
|
|
204
|
+
--corn-work-edge-code: auto;
|
|
205
|
+
--corn-work-edge-adds: auto;
|
|
195
206
|
/* Node fill by group */
|
|
196
207
|
--corn-map-group-app: auto;
|
|
197
208
|
--corn-map-group-pkg: auto;
|
package/explorer/view.js
CHANGED
|
@@ -16,6 +16,9 @@ import { clearScenario } from './scenario-ui.js';
|
|
|
16
16
|
import { measureParams } from './bench.js';
|
|
17
17
|
import { mergeLive, placeLiveNodes } from './live-model.js';
|
|
18
18
|
import { applyHouseLayout } from './house-model.js';
|
|
19
|
+
import { applyWorkLayout, enterWork, leaveWork } from './work-model.js';
|
|
20
|
+
import { isPhone } from './sheets.js';
|
|
21
|
+
import { clearSelection } from './engine/selection.js';
|
|
19
22
|
import { syncHint } from './hint.js';
|
|
20
23
|
import { ensurePagePieces } from './page-pieces.js';
|
|
21
24
|
import { TOPOLOGY_PATH, fetchTopology } from './engine/source.js';
|
|
@@ -84,13 +87,17 @@ export function setMap(nodes, edges) {
|
|
|
84
87
|
/** Where the nodes sit: the House view's plan here (house-model.js, PHY-11), every other view the engine's one layout (engine/topology.js `layoutMap`) */
|
|
85
88
|
function applyLayout() {
|
|
86
89
|
if (state.view === 'house') { computeDegreeCentrality(); applyHouseLayout(state); return; }
|
|
90
|
+
if (state.view === 'work') { applyWorkLayout(state, { phone: isPhone() }); return; } // the Work view's lanes (work-model.js)
|
|
87
91
|
layoutMap(pageInstance(), { placeLive: placeLiveNodes }); // the live layer is the page's (live-model.js): the engine places it with this
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
/** Switches between 'orbit' and 'dataflow'; the camera refits and the preset button follows */
|
|
91
95
|
export function setView(view) {
|
|
92
96
|
if (state.view === view) return;
|
|
97
|
+
if ((state.view === 'work' || view === 'work') && state.selectedNode) clearSelection(pageInstance(), { source: 'api' }); // a selection belongs to the view it was made in
|
|
98
|
+
if (state.view === 'work') leaveWork(state); // the map's nodes come back before the next view is laid out
|
|
93
99
|
state.view = view;
|
|
100
|
+
if (view === 'work') enterWork(state); // the Work view's nodes (work-view.js loads them)
|
|
94
101
|
clearScenario();
|
|
95
102
|
touchScene();
|
|
96
103
|
if (state.nodes.length) {
|
|
@@ -105,7 +112,7 @@ export function syncViewUi() {
|
|
|
105
112
|
const preset = state.view === 'dataflow';
|
|
106
113
|
// The View switch: the Map button is on for the map itself; Flow and House say theirs (house.js) in aria-pressed too
|
|
107
114
|
const map = $('preset-map-btn');
|
|
108
|
-
if (map) map.setAttribute('aria-pressed', String(state.view !== 'dataflow' && state.view !== 'house'));
|
|
115
|
+
if (map) map.setAttribute('aria-pressed', String(state.view !== 'dataflow' && state.view !== 'house' && state.view !== 'work'));
|
|
109
116
|
const btn = $('preset-dataflow-btn');
|
|
110
117
|
if (btn) btn.setAttribute('aria-pressed', String(preset));
|
|
111
118
|
ensurePagePieces(); // the Layers menu, if the page has its place
|
package/explorer/waiting-view.js
CHANGED
|
@@ -13,9 +13,9 @@ import { specGroupTitle, runGroupTitle, groupCountWords } from './waiting-model.
|
|
|
13
13
|
* The Specs tab's groups, each a heading with its count and its rows. Drafts past ten rows are folded behind a button on the header
|
|
14
14
|
* (`draftsOpen` says whether the person opened it). With a search, a group's count reads "2 of 6".
|
|
15
15
|
* @param {ReturnType<import('./waiting-model.js').specGroups>} groups
|
|
16
|
-
* @param {{
|
|
16
|
+
* @param {{ shown?: string | null, nowMs?: number, draftsOpen?: boolean | null, say?: (key: string) => string }} [opts]
|
|
17
17
|
*/
|
|
18
|
-
export function specGroupsHtml(groups, {
|
|
18
|
+
export function specGroupsHtml(groups, { shown = null, nowMs = Date.now(), draftsOpen = null, say } = {}) {
|
|
19
19
|
return groups.map((g) => {
|
|
20
20
|
const id = `spec-group-${g.key}`;
|
|
21
21
|
const words = `${specGroupTitle(g.key, say)} · ${groupCountWords(g)}`;
|
|
@@ -24,7 +24,7 @@ export function specGroupsHtml(groups, { current = null, nowMs = Date.now(), dra
|
|
|
24
24
|
const title = foldable
|
|
25
25
|
? `<button type="button" class="hx-forge-gtoggle" data-spec-group-toggle="${escHtml(g.key)}" aria-expanded="${!folded}" aria-controls="${id}-list" data-corn-kind="quiet">${escHtml(words)}</button>`
|
|
26
26
|
: escHtml(words);
|
|
27
|
-
const rows = g.rows.map((r) => specRowHtml(r.entry, {
|
|
27
|
+
const rows = g.rows.map((r) => specRowHtml(r.entry, { shown, nowMs })).join('');
|
|
28
28
|
return `<li class="hx-forge-group hx-spec-group" data-key="${id}" data-corn="spec-group" data-group="${escHtml(g.key)}"><h3 class="hx-forge-gtitle" id="${id}">${title}</h3>`
|
|
29
29
|
+ `<ul class="hx-forge-list" id="${id}-list" aria-labelledby="${id}"${folded ? ' hidden' : ''}>${rows}</ul></li>`;
|
|
30
30
|
}).join('');
|