cornfield 0.51.7 → 0.52.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/cli/cornfield.js +7 -0
- package/core/config.js +2 -1
- package/core/map-tokens.js +2 -4
- package/core/repo.js +59 -4
- package/core/strings.js +5 -0
- package/core/text.js +18 -0
- package/core/validate.js +17 -10
- package/explorer/engine/flow-legend.js +28 -0
- package/explorer/engine/flow-ui.js +3 -22
- package/explorer/engine/keyboard.js +28 -15
- package/explorer/engine/map-rect.js +2 -2
- package/explorer/engine/piece.js +27 -2
- package/explorer/engine/render.js +7 -4
- package/explorer/engine/roots.js +71 -0
- package/explorer/engine/search-status.js +2 -8
- package/explorer/flows.js +2 -1
- package/explorer/instance.js +39 -10
- package/explorer/pieces/around.js +114 -0
- package/explorer/pieces/layers.js +28 -14
- package/explorer/pieces/map.js +14 -1
- package/explorer/pieces/node-panel.js +33 -15
- package/explorer/pieces/search.js +43 -12
- package/explorer/scene.js +1 -1
- package/explorer/search-match.js +53 -0
- package/explorer/search-model.js +6 -48
- package/package.json +1 -1
- package/plugins/cloud/index.js +5 -3
- package/plugins/compose/index.js +12 -6
- package/plugins/docs/site.js +2 -2
- package/plugins/openapi/index.js +10 -5
- package/plugins/starter/index.js +2 -2
- package/plugins/world/index.js +3 -2
- package/server/agent-runs.js +3 -4
- package/server/components.js +4 -3
- package/server/db.js +7 -0
- package/server/files.js +97 -15
- package/server/forge-routes.js +8 -6
- package/server/proposal-walk.js +25 -6
- package/server/proposals.js +5 -3
- package/server/reviews.js +9 -2
- package/server/server.js +43 -31
- package/server/spec-poll.js +2 -2
package/explorer/instance.js
CHANGED
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
* returns the change, whose `announce()` says it when `quiet` held it back (the caller touches the scene first)
|
|
19
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
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)
|
|
21
|
-
* inst.active() the element that has the focus inside the root's tree (a shadow root's own, not the host)
|
|
21
|
+
* inst.active() the element that has the focus inside the root's tree (a shadow root's own, not the host), or inside any root that joined
|
|
22
|
+
* inst.extraRoots the other roots that belong to the instance (a leaf piece's own shadow root, in a scope), joined by engine/roots.js `joinRoot`: `active` looks in them too.
|
|
23
|
+
* `inst.el` still looks in the primary root only: a piece owns its elements, and a neighbour reaches it by an event or an `ask`
|
|
22
24
|
* inst.el an element of the instance by id, found inside its root and never by document id
|
|
23
25
|
* 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
|
|
24
26
|
* inst.slot what a module keeps for this instance (its map style), made on first use
|
|
@@ -60,7 +62,10 @@
|
|
|
60
62
|
* 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
|
|
61
63
|
* 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
|
|
62
64
|
* 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)
|
|
63
|
-
* announce text what a screen reader is told (engine/keyboard.js `announce
|
|
65
|
+
* announce text what a screen reader is told (engine/keyboard.js `announce`; the piece that owns a live region writes it: `announce:write`)
|
|
66
|
+
* root:changed (none) the primary root moved (`attach`) or a root joined or left (engine/roots.js): what listens on every root puts itself right
|
|
67
|
+
* map:ready (none) the map piece is mounted and has its topology (pieces/map.js); map:gone: it ended. The pieces around it (pieces/around.js) mount and unmount with it
|
|
68
|
+
* search:status text what the search's own live region says (engine/search-status.js; pieces/search.js writes it)
|
|
64
69
|
*
|
|
65
70
|
* What a piece is asked to do (`emit`ted to it):
|
|
66
71
|
* node:show-edge { edge } show this edge in the panel (engine/proposal.js `showEdge`)
|
|
@@ -73,6 +78,9 @@
|
|
|
73
78
|
* view view the view changed ('orbit', 'dataflow', 'house'): the Layers chip dims while the data-flow view is on (view.js on the page)
|
|
74
79
|
*
|
|
75
80
|
* What a piece asks of a neighbour that may not be there (`ask`: the first answer that is not `undefined`; nobody answering is a no):
|
|
81
|
+
* announce:write text -> true when a live region of a piece took it (the map's `#map-announcer`); announce:fallback text -> true: a piece that stands without a map has one
|
|
82
|
+
* panel:present (none) -> true: a node panel is part of this instance (the map says "Panel closed" and not "Selection cleared"); panel:covers (none) -> { right: px } the part of the map
|
|
83
|
+
* an open slide-over panel covers, else nothing; layers:present (none) -> true: a Layers menu is part of the instance
|
|
76
84
|
* search:active (none) is a search with matches on? -> boolean (the map's N and P step through its matches then)
|
|
77
85
|
* search:step by step to the next (+1) or previous (-1) match -> boolean, whether there was one
|
|
78
86
|
* live:section node the live layer's block for the node panel -> HTML, put in the panel as it is: whoever answers escapes what it shows
|
|
@@ -120,6 +128,7 @@ export function createInstance({ root: rootOpt = null, base = '', fetch: fetchOp
|
|
|
120
128
|
const fetchImpl = fetchOpt;
|
|
121
129
|
const initialRoot = root;
|
|
122
130
|
let attached = null;
|
|
131
|
+
const joined = new Set();
|
|
123
132
|
|
|
124
133
|
const on = (name, fn) => {
|
|
125
134
|
let set = events.get(name);
|
|
@@ -185,6 +194,24 @@ export function createInstance({ root: rootOpt = null, base = '', fetch: fetchOp
|
|
|
185
194
|
Object.defineProperty(theState, 'selectedNode', { enumerable: true, configurable: true, get: () => selNode, set: (v) => { commit(v, selEdge, 'state', false); } });
|
|
186
195
|
Object.defineProperty(theState, 'selectedEdge', { enumerable: true, configurable: true, get: () => selEdge, set: (v) => { commit(selNode, v, 'state', false); } });
|
|
187
196
|
|
|
197
|
+
/** The focused element of one tree: a Document's or a shadow root's `activeElement`; for an element, the tree it sits in, when the focus is inside it */
|
|
198
|
+
const activeIn = (r) => {
|
|
199
|
+
if (r.nodeType === 11) {
|
|
200
|
+
// A shadow root's own focus: asked of the root itself, which also answers inside a host's closed shadow root, where a walk from the document cannot
|
|
201
|
+
// look in. Where asking throws (happy-dom, while the focus is in another shadow root), it is found from the document down through the open roots
|
|
202
|
+
let own;
|
|
203
|
+
try { own = r.activeElement; } catch { own = undefined; }
|
|
204
|
+
if (own !== undefined) return own && own.getRootNode && own.getRootNode() === r ? own : null;
|
|
205
|
+
let el = doc.activeElement;
|
|
206
|
+
while (el && el.shadowRoot && el.shadowRoot.activeElement) el = el.shadowRoot.activeElement;
|
|
207
|
+
return el && el.getRootNode && el.getRootNode() === r ? el : null;
|
|
208
|
+
}
|
|
209
|
+
if (r.nodeType !== 1) return r.activeElement || null;
|
|
210
|
+
const tree = typeof r.getRootNode === 'function' ? r.getRootNode() : doc;
|
|
211
|
+
const focused = tree && tree.activeElement !== undefined ? tree.activeElement : doc.activeElement;
|
|
212
|
+
return focused && r.contains(focused) ? focused : null;
|
|
213
|
+
};
|
|
214
|
+
|
|
188
215
|
const inst = {
|
|
189
216
|
root,
|
|
190
217
|
doc,
|
|
@@ -244,27 +271,29 @@ export function createInstance({ root: rootOpt = null, base = '', fetch: fetchOp
|
|
|
244
271
|
attached = next;
|
|
245
272
|
root = next;
|
|
246
273
|
inst.root = next;
|
|
274
|
+
inst.emit('root:changed');
|
|
247
275
|
const release = () => {
|
|
248
276
|
if (attached !== next) return;
|
|
249
277
|
attached = null;
|
|
250
278
|
root = initialRoot;
|
|
251
279
|
inst.root = initialRoot;
|
|
280
|
+
inst.emit('root:changed');
|
|
252
281
|
inst.release(release);
|
|
253
282
|
if (!destroyed) inst.emit('attach:released'); // a piece that was refused (a second map in a scope) may have it now
|
|
254
283
|
};
|
|
255
284
|
cleanups.push(release);
|
|
256
285
|
return release;
|
|
257
286
|
},
|
|
258
|
-
/** The element with the focus in the root's own tree: a Document's or a shadow root's `activeElement`, or the document's when it is inside the root; else null */
|
|
287
|
+
/** The element with the focus in the root's own tree, or in a root that joined: a Document's or a shadow root's `activeElement`, or the document's when it is inside the root; else null */
|
|
259
288
|
active: () => {
|
|
260
|
-
if (!
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return focused && root.contains(focused) ? focused : null;
|
|
289
|
+
if (!doc) return null;
|
|
290
|
+
for (const r of [root, ...joined]) {
|
|
291
|
+
const found = r && activeIn(r);
|
|
292
|
+
if (found) return found;
|
|
293
|
+
}
|
|
294
|
+
return null;
|
|
267
295
|
},
|
|
296
|
+
extraRoots: joined,
|
|
268
297
|
|
|
269
298
|
// -- what the viewer prefers --------------------------------------------------------------------------------------------------
|
|
270
299
|
/** A reader of the computed custom properties at the root (`(name) => value`), or null where there is no page */
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/pieces/around
|
|
3
|
+
*
|
|
4
|
+
* The pieces around the map (node panel, Layers menu, search) as a component mounts them (spec 0011 D4, D5, D7): each in a shadow root of its own, on the
|
|
5
|
+
* instance of the `<corn-scope>` it sits in, beside a `<corn-map>` that has a root of its own too. This is what a shell of those tags calls; cornfield's page
|
|
6
|
+
* and `<corn-review>` mount the same pieces themselves, in one root, and do not use it.
|
|
7
|
+
*
|
|
8
|
+
* const around = mountAround(piece, root, inst, options) -> { inst, update, destroy, focusField }
|
|
9
|
+
*
|
|
10
|
+
* piece the piece's module (`explorer/pieces/node-panel.js`, `layers.js`, `search.js`): its `mount(root, inst, options)`
|
|
11
|
+
* root the shadow root of the tag
|
|
12
|
+
* inst the scope's instance, or null: no scope around the tag, so a private instance with no map, which this says (`needsScope`)
|
|
13
|
+
* options tokens (the default `--corn-*` CSS text), piece (the options the piece is mounted with), initial (its first `update`), noMap (the `strings` key said
|
|
14
|
+
* while there is no map: `needsMap`, or the panel's own empty state), onSearch ({ query, current }, the instance's `search` event)
|
|
15
|
+
*
|
|
16
|
+
* What it does so that three roots can share one instance:
|
|
17
|
+
* - the root joins the instance (`joinRoot`, engine/roots.js): its keys and its focus are the instance's, so `/` pressed on the map reaches the search and a click in the
|
|
18
|
+
* host's page outside the Layers menu closes it;
|
|
19
|
+
* - the server's theme is adopted into the root (`use-theme` on the scope), after the tag's own styles;
|
|
20
|
+
* - the piece mounts when the instance has a map with nodes (`map:ready`, then the `scene` its data brings) and ends when it has none (`map:gone`): the
|
|
21
|
+
* pieces read the map's camera, scene and visibility, so with none they say what they need in its place (`needsMap`), and while the map waits on its
|
|
22
|
+
* server (loading, signed out, offline: the map's own card says which) that they wait for it (`waitingForMap`). Tags can come in any order;
|
|
23
|
+
* - it has a live region of its own, said in only when no map has one (`announce:fallback`): a panel or a search beside no map still speaks.
|
|
24
|
+
* Nothing here reads the page: no `document`, no id of a neighbour. It never throws for a missing scope or map.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { createInstance } from '../instance.js';
|
|
28
|
+
import { scopeOf, place } from '../engine/piece.js';
|
|
29
|
+
import { joinRoot } from '../engine/roots.js';
|
|
30
|
+
import { speaker } from '../engine/keyboard.js';
|
|
31
|
+
import { t } from '../engine/strings.js';
|
|
32
|
+
import { escapeHtml } from '../../core/text.js';
|
|
33
|
+
import { adoptDefaultTokens } from './adopt-tokens.js';
|
|
34
|
+
import { scopeInfo } from './scope-link.js';
|
|
35
|
+
|
|
36
|
+
/** The document, and the shadow root the tag's host sits in if it is in one: where the default tokens go (as pieces/map.js does) */
|
|
37
|
+
function adoptTokens(root, css) {
|
|
38
|
+
const host = root.nodeType === 11 ? root.host : root;
|
|
39
|
+
const where = host && typeof host.getRootNode === 'function' ? host.getRootNode() : null;
|
|
40
|
+
if (!where || !css) return;
|
|
41
|
+
adoptDefaultTokens(where.nodeType === 9 ? where : where.ownerDocument, css);
|
|
42
|
+
if (where.nodeType === 11) adoptDefaultTokens(where, css);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {{ mount: Function }} piece
|
|
47
|
+
* @param {ShadowRoot|Element} root
|
|
48
|
+
* @param {ReturnType<typeof createInstance>|null} inst
|
|
49
|
+
* @param {{ tokens?: string, piece?: object, initial?: object, noMap?: string, onSearch?: (d: { query: string, current: string | null }) => void }} [options]
|
|
50
|
+
*/
|
|
51
|
+
export function mountAround(piece, root, inst, options = {}) {
|
|
52
|
+
const ownsInstance = !inst;
|
|
53
|
+
if (ownsInstance) inst = createInstance({ root });
|
|
54
|
+
const info = scopeInfo(inst);
|
|
55
|
+
const scope = scopeOf(inst);
|
|
56
|
+
adoptTokens(root, options.tokens);
|
|
57
|
+
scope.own(joinRoot(inst, root));
|
|
58
|
+
if (info && info.serverTheme) scope.own(info.serverTheme.adopt(root));
|
|
59
|
+
// A live region for the words this piece says when no map is there to say them
|
|
60
|
+
const [region] = place(inst, root, '<p class="hx-sr-only" role="status" aria-live="polite"></p>', null, 'announcer');
|
|
61
|
+
const say = speaker(inst, region);
|
|
62
|
+
scope.on('announce:fallback', (text) => { say(text); return true; });
|
|
63
|
+
scope.own(() => region.remove());
|
|
64
|
+
|
|
65
|
+
let real = null;
|
|
66
|
+
let note = [];
|
|
67
|
+
let pending = { ...(options.initial || {}) };
|
|
68
|
+
let ended = false;
|
|
69
|
+
|
|
70
|
+
const dropNote = () => { for (const el of note) el.remove(); note = []; };
|
|
71
|
+
/** The map is there and has nodes: a map still loading, refused by its server (signed out, not a maintainer) or offline has none, and a search or a
|
|
72
|
+
* Layers menu over nothing would say "No match" or count layers of a map nobody can see. The map's own card says what is wrong, once */
|
|
73
|
+
const hasMap = () => !!inst.map && inst.state.nodes.length > 0;
|
|
74
|
+
const showNote = (gone = false) => {
|
|
75
|
+
if (ended) return;
|
|
76
|
+
const words = !info ? t(inst, 'needsScope') : options.noMap === 'nodePanelEmpty' ? t(inst, 'nodePanelEmpty') : inst.map && !gone ? t(inst, 'waitingForMap') : t(inst, 'needsMap');
|
|
77
|
+
if (note.length && note[0].textContent === words) return;
|
|
78
|
+
dropNote();
|
|
79
|
+
note = place(inst, root, `<p class="hx-needs" data-corn="empty">${escapeHtml(words)}</p>`, null, 'needs');
|
|
80
|
+
};
|
|
81
|
+
const mountReal = () => {
|
|
82
|
+
if (real || ended) return;
|
|
83
|
+
if (!hasMap()) { showNote(); return; }
|
|
84
|
+
dropNote();
|
|
85
|
+
real = piece.mount(root, inst, { ...(options.piece || {}), inline: true, phone: false });
|
|
86
|
+
if (Object.keys(pending).length) { real.update(pending); pending = {}; }
|
|
87
|
+
};
|
|
88
|
+
const unmountReal = () => { if (real) { real.destroy(); real = null; } };
|
|
89
|
+
|
|
90
|
+
scope.on('map:ready', mountReal);
|
|
91
|
+
scope.on('scene', () => { if (!real) mountReal(); }); // the map's data came (its server answered, or the host handed it in)
|
|
92
|
+
scope.on('map:gone', () => { unmountReal(); showNote(true); }); // (said while the map ends: the instance may still hold it)
|
|
93
|
+
if (options.onSearch) scope.on('search', (d) => options.onSearch(d));
|
|
94
|
+
mountReal();
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
inst,
|
|
98
|
+
/** Takes the properties that changed; one that arrives before the piece is mounted is applied when it is */
|
|
99
|
+
update(next = {}) {
|
|
100
|
+
if (ended) return;
|
|
101
|
+
if (real) real.update(next); else Object.assign(pending, next);
|
|
102
|
+
},
|
|
103
|
+
/** The search's field takes the focus (nothing when the piece is not mounted, or is not a search) */
|
|
104
|
+
focusField() { if (real && typeof real.focusField === 'function') real.focusField(); },
|
|
105
|
+
destroy() {
|
|
106
|
+
if (ended) return;
|
|
107
|
+
ended = true;
|
|
108
|
+
unmountReal();
|
|
109
|
+
dropNote();
|
|
110
|
+
scope.destroy();
|
|
111
|
+
if (ownsInstance) inst.destroy();
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -31,10 +31,11 @@ import { STROKE_TOKEN, kindToken, mapStyleOf } from '../engine/map-style.js';
|
|
|
31
31
|
import { over, parseColor, contrast } from '../../core/color.js';
|
|
32
32
|
import { DARK_GROUND, LIGHT_GROUND } from '../theme-model.js';
|
|
33
33
|
import { t } from '../engine/strings.js';
|
|
34
|
-
import { renderFlowLegend } from '../engine/flow-
|
|
34
|
+
import { renderFlowLegend } from '../engine/flow-legend.js';
|
|
35
35
|
import { isOn, keepLayersIn, layerRows, redrawing, setProjectLayers, swatch, toggleAllLayers, toggleLayer } from '../engine/layers.js';
|
|
36
36
|
import { layerOn } from '../layer-model.js';
|
|
37
37
|
import { scopeOf, place, addParts } from '../engine/piece.js';
|
|
38
|
+
import { listenRoots, onPageClick } from '../engine/roots.js';
|
|
38
39
|
|
|
39
40
|
/** The markup of the piece: the chip and its menu (its one place is `menu`) */
|
|
40
41
|
export const markup = () => ({
|
|
@@ -102,6 +103,15 @@ export function mount(root, inst, options = {}) {
|
|
|
102
103
|
function setMenu(open) {
|
|
103
104
|
menu.hidden = !open;
|
|
104
105
|
btn.setAttribute('aria-expanded', String(open));
|
|
106
|
+
if (open && options.inline) alignMenu();
|
|
107
|
+
}
|
|
108
|
+
/** In a box of its own (`<corn-layers>`) the menu hangs from the chip's start; where that runs past the window's end (a chip at the right of a host's
|
|
109
|
+
* toolbar) and there is room the other way, it hangs from the chip's end instead (`hx-menu--end`) */
|
|
110
|
+
function alignMenu() {
|
|
111
|
+
menu.classList.remove('hx-menu--end');
|
|
112
|
+
const room = inst.win ? inst.win.innerWidth : 0;
|
|
113
|
+
const r = menu.getBoundingClientRect();
|
|
114
|
+
if (room && r.width && r.right > room && wrap.getBoundingClientRect().right - r.width >= 0) menu.classList.add('hx-menu--end');
|
|
105
115
|
}
|
|
106
116
|
const toggleMenu = (open) => setMenu(open === undefined ? menu.hidden : !!open);
|
|
107
117
|
const closeMenu = () => setMenu(false);
|
|
@@ -129,7 +139,7 @@ export function mount(root, inst, options = {}) {
|
|
|
129
139
|
const ring = ringOf(color, surface);
|
|
130
140
|
const glow = on && state.theme !== 'light' ? (/^#[0-9a-f]{6}$/i.test(color) ? `0 0 8px ${color}90` : `0 0 8px color-mix(in srgb, ${color} 56%, transparent)`) : 'none';
|
|
131
141
|
const css = `background-color: ${color}; box-shadow: ${glow}${ring && ring.stroke ? `; --hx-dot-ring: ${ring.stroke}` : ''}`;
|
|
132
|
-
return `<span class="hx-dot${extra ? ' hx-kind-swatch' : ''}${ring ? ' is-ringed' : ''}" data-corn="swatch"${extra} style="${escHtml(css)}"></span>`;
|
|
142
|
+
return `<span class="hx-dot${extra ? ' hx-kind-swatch' : ''}${ring ? ' is-ringed' : ''}" data-corn="swatch"${extra} data-style="${escHtml(css)}"></span>`;
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
// -- the kinds of a row ---------------------------------------------------------------------------------------------------------
|
|
@@ -230,7 +240,7 @@ export function mount(root, inst, options = {}) {
|
|
|
230
240
|
const again = [...container.querySelectorAll('[data-action]')].find((el) => el.getAttribute('data-action') === was.action && el.getAttribute('data-layer') === was.layer);
|
|
231
241
|
if (again && typeof again.focus === 'function') again.focus({ preventScroll: true });
|
|
232
242
|
}
|
|
233
|
-
renderFlowLegend(inst);
|
|
243
|
+
renderFlowLegend(inst, own('flow-legend'));
|
|
234
244
|
renderEdgeKey();
|
|
235
245
|
renderCloudLegend();
|
|
236
246
|
addParts(own('flow-legend'));
|
|
@@ -282,22 +292,26 @@ export function mount(root, inst, options = {}) {
|
|
|
282
292
|
const action = ACTIONS[target.dataset.action];
|
|
283
293
|
if (action) action(target);
|
|
284
294
|
});
|
|
285
|
-
// Any click outside the menu closes it; a click on one of its rows does not. Whether it was inside is
|
|
286
|
-
//
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
+
// Any click outside the menu closes it; a click on one of its rows does not. Whether it was inside is known before the action (a row's action draws the
|
|
296
|
+
// rows again, the clicked node is then out of the page, and asking afterwards would take a click on a row for one outside): the menu's own element hears
|
|
297
|
+
// the click on its way in, and the page decides once the click has passed. The page's own path is not enough: in a host's closed shadow root the
|
|
298
|
+
// document's `composedPath()` stops at that root's host, so a click on a row would look like one outside
|
|
299
|
+
const inside = new WeakSet();
|
|
300
|
+
scope.listen(wrap, 'click', (e) => { inside.add(e); }, true);
|
|
301
|
+
scope.own(onPageClick(inst, (e) => {
|
|
302
|
+
if (menu.hidden || inside.has(e)) return;
|
|
303
|
+
const path = typeof e.composedPath === 'function' ? e.composedPath() : [e.target];
|
|
304
|
+
if (!path.includes(wrap)) closeMenu();
|
|
305
|
+
}, { capture: false }));
|
|
306
|
+
// Escape with the menu open closes it, and its chip has the focus again (a key in any root of the instance: the map's too)
|
|
307
|
+
scope.own(listenRoots(inst, 'keydown', (e) => {
|
|
295
308
|
if (e.key !== 'Escape' || menu.hidden) return;
|
|
296
309
|
closeMenu();
|
|
297
310
|
btn.focus();
|
|
298
|
-
});
|
|
311
|
+
}));
|
|
299
312
|
|
|
300
313
|
// -- following the instance ------------------------------------------------------------------------------------------------------
|
|
314
|
+
scope.on('layers:present', () => true); // the map's keys know there is a menu to turn a layer on in
|
|
301
315
|
scope.on('layers:redraw', renderLayerToggles);
|
|
302
316
|
scope.on('theme', renderLayerToggles); // the dots and the legends are drawn in the theme's colours
|
|
303
317
|
scope.on('view', syncView);
|
package/explorer/pieces/map.js
CHANGED
|
@@ -46,7 +46,7 @@ import { createInstance } from '../instance.js';
|
|
|
46
46
|
import { createMap } from '../engine/render.js';
|
|
47
47
|
import { mapStyleOf } from '../engine/map-style.js';
|
|
48
48
|
import { layoutMap, setTopology as installTopology } from '../engine/topology.js';
|
|
49
|
-
import { initKeyboard, resetKeyboard } from '../engine/keyboard.js';
|
|
49
|
+
import { initKeyboard, resetKeyboard, speaker } from '../engine/keyboard.js';
|
|
50
50
|
import { selectNode, clearSelection } from '../engine/selection.js';
|
|
51
51
|
import { stopFlight } from '../engine/fly.js';
|
|
52
52
|
import { scopeOf, place } from '../engine/piece.js';
|
|
@@ -90,6 +90,7 @@ function refused(root, inst, info) {
|
|
|
90
90
|
return {
|
|
91
91
|
inst,
|
|
92
92
|
refused: true,
|
|
93
|
+
selection: () => null,
|
|
93
94
|
update: none,
|
|
94
95
|
fit: none,
|
|
95
96
|
refresh: none,
|
|
@@ -139,6 +140,7 @@ function mountWithSource(root, options) {
|
|
|
139
140
|
return {
|
|
140
141
|
get inst() { return real ? real.inst : null; },
|
|
141
142
|
get map() { return real ? real.map : null; },
|
|
143
|
+
selection() { return real ? real.selection() : null; },
|
|
142
144
|
update(next = {}) { if (real) real.update(next); else Object.assign(pending, next); },
|
|
143
145
|
fit() { if (real) real.fit(); },
|
|
144
146
|
focusNode(id) { return real ? real.focusNode(id) : false; },
|
|
@@ -193,6 +195,9 @@ function mountOn(root, inst, options, privateScope) {
|
|
|
193
195
|
const made = place(inst, root, slots ? html : `<div data-corn="map-stage">${html}</div>`, slots, 'stage');
|
|
194
196
|
const find = (sel) => made.map((el) => (el.matches(sel) ? el : el.querySelector(sel))).find(Boolean);
|
|
195
197
|
scope.own(() => { for (const el of [...made, state.canvas]) if (el) el.remove(); });
|
|
198
|
+
// The announcer is this piece's: what a screen reader is told (engine/keyboard.js `announce`) is written in it
|
|
199
|
+
const announcer = find('#map-announcer');
|
|
200
|
+
if (announcer) { const say = speaker(inst, announcer); scope.on('announce:write', (text) => { say(text); return true; }); }
|
|
196
201
|
// What the person sees while the data loads and when it cannot be had (pieces/status.js): only a map that has a source
|
|
197
202
|
const stage = made.find((el) => el.matches('[data-corn="map-stage"]')) || null;
|
|
198
203
|
if (source && stage) {
|
|
@@ -400,10 +405,18 @@ function mountOn(root, inst, options, privateScope) {
|
|
|
400
405
|
update(first);
|
|
401
406
|
takeSource();
|
|
402
407
|
refresh();
|
|
408
|
+
scope.own(() => inst.emit('map:gone')); // the pieces around the map (pieces/around.js) go back to waiting for one
|
|
409
|
+
inst.emit('map:ready'); // ... and the ones that waited for it mount
|
|
403
410
|
|
|
404
411
|
return {
|
|
405
412
|
inst,
|
|
406
413
|
map,
|
|
414
|
+
/** What the instance has selected now, whoever chose it (a piece mounted late is handed it): `{ id, kind }`, or null */
|
|
415
|
+
selection() {
|
|
416
|
+
if (state.selectedNode) return { id: state.selectedNode.id, kind: 'node' };
|
|
417
|
+
if (state.selectedEdge) return { id: `${state.selectedEdge.from}->${state.selectedEdge.to}`, kind: 'edge' };
|
|
418
|
+
return null;
|
|
419
|
+
},
|
|
407
420
|
update,
|
|
408
421
|
destroy,
|
|
409
422
|
/** The whole map in view */
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
*
|
|
18
18
|
* @param {ParentNode} root where the panel goes when `options.slots` names no place
|
|
19
19
|
* @param {ReturnType<typeof import('../instance.js').createInstance>} inst the instance; its map must be made (engine/render.js)
|
|
20
|
-
*
|
|
20
|
+
* `options.inline` is the panel in a box of its own (`<corn-node-panel>`): it fills the box its host gives it instead of sliding over the map, never becomes a phone's
|
|
21
|
+
* bottom sheet (no dock, no dim layer: the host's layout decides where it is), says what it needs while nothing is selected (`empty`), and covers nothing of the map.
|
|
22
|
+
*
|
|
23
|
+
* @param {{ slots?: { drawer?: Node, backdrop?: Node }, inline?: boolean }} [options]
|
|
21
24
|
* @returns {{ update: (props?: { node?: object | null }) => void, destroy: () => void, show: Function, close: Function, repaintThreads: Function, copySpec: Function, startRun: Function, keepSelectedInView: Function, elements: Element[] }}
|
|
22
25
|
* `update({ node })` shows that node (or closes the panel for `null`) without selecting it; `update()` paints the open panel again from the
|
|
23
26
|
* instance's state (after the host changed the topology or the words).
|
|
@@ -290,9 +293,10 @@ export function mount(root, inst, options = {}) {
|
|
|
290
293
|
const { state } = inst;
|
|
291
294
|
const scope = scopeOf(inst);
|
|
292
295
|
const sections = sectionsOf(inst);
|
|
296
|
+
const inline = options.inline === true;
|
|
293
297
|
const made = [
|
|
294
298
|
...place(inst, root, markup().drawer, options.slots, 'drawer'),
|
|
295
|
-
...place(inst, root, markup().backdrop, options.slots, 'backdrop'),
|
|
299
|
+
...(inline ? place(inst, root, `<p class="hx-panel-empty" data-corn="empty">${escHtml(t(inst, 'nodePanelEmpty'))}</p>`, null, 'empty') : place(inst, root, markup().backdrop, options.slots, 'backdrop')),
|
|
296
300
|
];
|
|
297
301
|
/** An element of this piece by id (the piece's own, whatever else the root holds) */
|
|
298
302
|
const own = (id) => {
|
|
@@ -305,7 +309,9 @@ export function mount(root, inst, options = {}) {
|
|
|
305
309
|
};
|
|
306
310
|
scope.keepParts(...made);
|
|
307
311
|
const drawer = own('spec-drawer');
|
|
308
|
-
const backdrop = own('drawer-backdrop');
|
|
312
|
+
const backdrop = inline ? { hidden: true } : own('drawer-backdrop'); // (a box of its own has no dim layer)
|
|
313
|
+
const empty = inline ? made.find((el) => el.matches('[data-corn="empty"]')) : null;
|
|
314
|
+
const setEmpty = (shown) => { if (empty) empty.hidden = !shown; };
|
|
309
315
|
let gone = false;
|
|
310
316
|
|
|
311
317
|
const litNow = () => activeSubgraph(state.selectedNode, inst.viewEdges(), { throughChildren: state.throughChildren, kind: state.selectedKind });
|
|
@@ -434,8 +440,9 @@ export function mount(root, inst, options = {}) {
|
|
|
434
440
|
drawer.classList.add('drawer-open');
|
|
435
441
|
drawer.inert = false; // closed, it waits off screen: inert, so Tab never reaches its buttons (MAP-02)
|
|
436
442
|
backdrop.hidden = false;
|
|
437
|
-
|
|
438
|
-
if (!
|
|
443
|
+
setEmpty(false);
|
|
444
|
+
if (!inline) showSheet(inst, 'drawer'); // on a phone it takes Work's place (the node sheet and Work take turns), and comes back from away when its node is tapped again
|
|
445
|
+
if (!frame && !inline) keepSelectedInView(); // with `frame`, the selection flies the camera to the node once this returns (engine/selection.js)
|
|
439
446
|
inst.emit('node:painted', { node });
|
|
440
447
|
}
|
|
441
448
|
|
|
@@ -469,6 +476,7 @@ export function mount(root, inst, options = {}) {
|
|
|
469
476
|
drawer.classList.add('drawer-open');
|
|
470
477
|
drawer.inert = false; // closed, the panel is inert (MAP-02): open for an edge, its links and its Close are reached as a node's are
|
|
471
478
|
backdrop.hidden = false;
|
|
479
|
+
setEmpty(false);
|
|
472
480
|
}
|
|
473
481
|
|
|
474
482
|
/**
|
|
@@ -489,7 +497,8 @@ export function mount(root, inst, options = {}) {
|
|
|
489
497
|
drawer.classList.remove('drawer-open');
|
|
490
498
|
drawer.inert = true;
|
|
491
499
|
backdrop.hidden = true;
|
|
492
|
-
|
|
500
|
+
setEmpty(true);
|
|
501
|
+
if (!inline) collapseSheet(inst, 'drawer'); // the next node opens as a peek on a phone
|
|
493
502
|
}
|
|
494
503
|
|
|
495
504
|
/** Start a run: the Start dialog of the Work panel, on the proposal that is open */
|
|
@@ -525,10 +534,12 @@ export function mount(root, inst, options = {}) {
|
|
|
525
534
|
// The threads that mention nodes changed (the list was read, or the map changed): the section is drawn again
|
|
526
535
|
scope.on('threads:changed', () => repaintThreads());
|
|
527
536
|
// The dim layer behind the panel: on a phone a tap there folds the panel to its peek; elsewhere it closes it
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
537
|
+
if (!inline) {
|
|
538
|
+
scope.listen(backdrop, 'click', (e) => {
|
|
539
|
+
if (isPhone(inst)) { onBackdrop(inst, e); return; }
|
|
540
|
+
clearSelection(inst, { source: 'tap' });
|
|
541
|
+
}, true);
|
|
542
|
+
}
|
|
532
543
|
// Escape anywhere in the panel closes it, and the map has the focus again
|
|
533
544
|
scope.listen(drawer, 'keydown', (e) => {
|
|
534
545
|
if (e.key !== 'Escape' || e.defaultPrevented) return;
|
|
@@ -539,6 +550,9 @@ export function mount(root, inst, options = {}) {
|
|
|
539
550
|
announce(inst, 'Panel closed');
|
|
540
551
|
});
|
|
541
552
|
|
|
553
|
+
scope.on('panel:present', () => true); // the map says "Panel closed", not "Selection cleared"
|
|
554
|
+
// A slide-over covers the right of the map by its width; a panel in a box of its own (`inline`) covers nothing
|
|
555
|
+
scope.on('panel:covers', () => (!inline && !gone && !drawer.hidden && drawer.classList.contains('drawer-open') ? { right: drawer.offsetWidth } : undefined));
|
|
542
556
|
scope.on('node:show', ({ node, frame }) => show(node, { frame }));
|
|
543
557
|
scope.on('node:close', close);
|
|
544
558
|
scope.on('node:show-edge', ({ edge }) => showEdge(edge));
|
|
@@ -546,14 +560,18 @@ export function mount(root, inst, options = {}) {
|
|
|
546
560
|
scope.on('node:focus', () => {
|
|
547
561
|
const title = own('drawer-title');
|
|
548
562
|
if (!title) return;
|
|
563
|
+
// A second panel in one scope (two tags, one maybe hidden by the host's layout) leaves the focus where the first that could take it put it
|
|
564
|
+
const now = inst.active();
|
|
565
|
+
if (inline && now && now !== title && typeof now.matches === 'function' && now.matches('[data-corn="node-title"]')) return;
|
|
549
566
|
title.setAttribute('tabindex', '-1');
|
|
550
567
|
title.focus();
|
|
551
568
|
});
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
569
|
+
if (!inline) {
|
|
570
|
+
scope.own(onCoveredChange(inst, () => keepSelectedInView()));
|
|
571
|
+
initSheets(inst);
|
|
572
|
+
registerSheet(inst, 'drawer', drawer, { stub: () => ({ title: (own('drawer-title') && own('drawer-title').textContent) || 'Node' }) });
|
|
573
|
+
scope.own(() => unregisterSheet(inst, 'drawer'));
|
|
574
|
+
}
|
|
557
575
|
|
|
558
576
|
// A node was selected before the panel came: it shows it
|
|
559
577
|
if (state.selectedNode) show(state.selectedNode, { frame: false });
|
|
@@ -39,6 +39,7 @@ import { layerOn, projectLayerKey } from '../layer-model.js';
|
|
|
39
39
|
import { showSearchStatus, updateSearchStatus } from '../engine/search-status.js';
|
|
40
40
|
import { countText, moreLine, noMatchLine, searchNodes, stepIndex } from '../search-model.js';
|
|
41
41
|
import { scopeOf, place } from '../engine/piece.js';
|
|
42
|
+
import { listenRoots } from '../engine/roots.js';
|
|
42
43
|
|
|
43
44
|
/** The two fields: the desktop's and the phone's bar. Each has its input, count, list and the live region it shares with the other */
|
|
44
45
|
const FIELDS = [
|
|
@@ -52,12 +53,12 @@ export const MATCH_ZOOM = 1;
|
|
|
52
53
|
const FRAME_STOP = Symbol('frame all');
|
|
53
54
|
|
|
54
55
|
/** The markup of the piece: the field with the button that opens the phone's bar (`field`), and the phone's bar (`bar`) */
|
|
55
|
-
export const markup = () => ({
|
|
56
|
-
field: `<button type="button" id="mobile-search-toggle" class="hx-hdr-icon hx-only-mobile" data-corn="mobile-search-button" data-action="toggle-mobile-search" aria-label="Open Search" title="Search nodes" data-corn-kind="icon">
|
|
56
|
+
export const markup = ({ phone = true } = {}) => ({
|
|
57
|
+
field: `${phone ? `<button type="button" id="mobile-search-toggle" class="hx-hdr-icon hx-only-mobile" data-corn="mobile-search-button" data-action="toggle-mobile-search" aria-label="Open Search" title="Search nodes" data-corn-kind="icon">
|
|
57
58
|
<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="7" cy="7" r="4.5" /><path d="M10.5 10.5L14 14" /></svg>
|
|
58
59
|
</button>
|
|
59
60
|
|
|
60
|
-
<div class="hx-search" role="search" data-corn="search">
|
|
61
|
+
` : ''}<div class="hx-search" role="search" data-corn="search">
|
|
61
62
|
<svg class="hx-search-icon" viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true" focusable="false"><circle cx="7" cy="7" r="4.5" /><path d="M10.5 10.5L14 14" /></svg>
|
|
62
63
|
<input type="text" id="node-search" class="hx-search-input" placeholder="Search..." data-corn-string-placeholder="searchPlaceholder" aria-label="Search nodes" aria-keyshortcuts="/" data-corn="search-input" />
|
|
63
64
|
<kbd class="hx-kbd" data-corn="search-key" aria-hidden="true">/</kbd>
|
|
@@ -70,7 +71,7 @@ export const markup = () => ({
|
|
|
70
71
|
<div id="search-status" class="hx-search-status" role="status" aria-live="polite" data-corn="search-status"></div>
|
|
71
72
|
<div id="search-results" class="hx-search-results" data-corn="search-results" hidden></div>
|
|
72
73
|
</div>`,
|
|
73
|
-
bar: `<div id="mobile-search-bar" class="hx-mobile-search glass-header" role="search" hidden data-corn="mobile-search">
|
|
74
|
+
bar: !phone ? '' : `<div id="mobile-search-bar" class="hx-mobile-search glass-header" role="search" hidden data-corn="mobile-search">
|
|
74
75
|
<input type="text" id="mobile-node-search" class="hx-input hx-input--wide" placeholder="Search nodes, apps, components..." aria-label="Search nodes" data-corn="search-input" />
|
|
75
76
|
<button type="button" class="hx-textbtn" data-action="close-mobile-search" data-corn-kind="quiet">Cancel</button>
|
|
76
77
|
<span id="mobile-search-steps" class="hx-search-steps" data-corn="search-steps" hidden>
|
|
@@ -120,8 +121,8 @@ export function mount(root, inst, options = {}) {
|
|
|
120
121
|
const { state } = inst;
|
|
121
122
|
const scope = scopeOf(inst);
|
|
122
123
|
const made = [
|
|
123
|
-
...place(inst, root, markup().field, options.slots, 'field'),
|
|
124
|
-
...place(inst, root, markup().bar, options.slots, 'bar'),
|
|
124
|
+
...place(inst, root, markup({ phone: options.phone !== false }).field, options.slots, 'field'),
|
|
125
|
+
...place(inst, root, markup({ phone: options.phone !== false }).bar, options.slots, 'bar'),
|
|
125
126
|
];
|
|
126
127
|
/** An element of this piece by id */
|
|
127
128
|
const own = (id) => {
|
|
@@ -133,6 +134,8 @@ export function mount(root, inst, options = {}) {
|
|
|
133
134
|
return null;
|
|
134
135
|
};
|
|
135
136
|
scope.keepParts(...made);
|
|
137
|
+
/** The fields this mount has: both on cornfield's page; the field alone in a box of its own (`options.phone: false`, `<corn-search>`) */
|
|
138
|
+
const fields = FIELDS.filter((f) => own(f.input));
|
|
136
139
|
let memo = null; // { key, nodes, result }
|
|
137
140
|
let chosen = 0;
|
|
138
141
|
|
|
@@ -163,7 +166,7 @@ export function mount(root, inst, options = {}) {
|
|
|
163
166
|
function paintSearch({ keepOpen = true } = {}) {
|
|
164
167
|
const result = currentResult();
|
|
165
168
|
const text = countText(result, state.searchCurrent);
|
|
166
|
-
for (const field of
|
|
169
|
+
for (const field of fields) {
|
|
167
170
|
const count = own(field.count);
|
|
168
171
|
if (count) { count.textContent = text; count.dataset.empty = result.query && !result.total ? 'true' : 'false'; }
|
|
169
172
|
const steps = own(field.steps);
|
|
@@ -220,7 +223,7 @@ export function mount(root, inst, options = {}) {
|
|
|
220
223
|
state.searchQuery = query;
|
|
221
224
|
if (changed) state.searchCurrent = null; // a new question has no current answer yet
|
|
222
225
|
inst.touchScene();
|
|
223
|
-
for (const field of
|
|
226
|
+
for (const field of fields) {
|
|
224
227
|
const input = own(field.input);
|
|
225
228
|
if (input && input.value !== value) input.value = value || '';
|
|
226
229
|
const list = listOf(field);
|
|
@@ -340,7 +343,7 @@ export function mount(root, inst, options = {}) {
|
|
|
340
343
|
if (!match) return;
|
|
341
344
|
chooseMatch(match);
|
|
342
345
|
// On a phone the list would cover the match: it shuts, and the focus goes to the next-match button, which stays
|
|
343
|
-
const field =
|
|
346
|
+
const field = fields.find((f) => listOf(f) === e.currentTarget);
|
|
344
347
|
if (field && field.input === 'mobile-node-search' && isPhone(inst)) {
|
|
345
348
|
closeList(field);
|
|
346
349
|
const next = own(field.steps) && own(field.steps).querySelector('[data-action="search-next"]');
|
|
@@ -370,7 +373,7 @@ export function mount(root, inst, options = {}) {
|
|
|
370
373
|
}
|
|
371
374
|
|
|
372
375
|
// Both fields, their list, and the step and clear buttons
|
|
373
|
-
for (const field of
|
|
376
|
+
for (const field of fields) {
|
|
374
377
|
const input = own(field.input);
|
|
375
378
|
// A combobox whose popup is a listbox: its options (Frame all, then the rows) in labelled groups, reached with the down arrow and
|
|
376
379
|
// walked with the arrows (the focus moves from option to option), so a screen reader hears each row and its group
|
|
@@ -420,11 +423,37 @@ export function mount(root, inst, options = {}) {
|
|
|
420
423
|
const open = own('mobile-search-toggle');
|
|
421
424
|
if (open) open.click();
|
|
422
425
|
}
|
|
423
|
-
|
|
424
|
-
|
|
426
|
+
// On every root of the instance: with the map in another shadow root, `/` there reaches the field here
|
|
427
|
+
const tree = typeof root.getRootNode === 'function' ? root.getRootNode() : root;
|
|
428
|
+
scope.own(listenRoots(inst, 'keydown', (e) => {
|
|
429
|
+
if (e.key === '/' && !e.ctrlKey && !e.metaKey && !e.altKey && !typing(e.target) && !(tree.querySelector && tree.querySelector('[data-corn="dialog-scrim"]:not([hidden]), .hx-mockup-dialog'))) {
|
|
425
430
|
e.preventDefault();
|
|
431
|
+
// two search tags in one scope: the first that took the focus keeps it
|
|
432
|
+
const now = inst.active();
|
|
433
|
+
if (now && typeof now.matches === 'function' && now.matches('[data-corn="search-input"]') && !made.some((el) => el.contains(now))) return;
|
|
426
434
|
goToSearch();
|
|
427
435
|
}
|
|
436
|
+
}));
|
|
437
|
+
// What the live regions beside the fields say (engine/search-status.js tells the instance; the regions are this piece's own). A scope may hold two search
|
|
438
|
+
// tags: they are one search (one query, one current match), and only one of them speaks, the one last used (else the first), so it is said once
|
|
439
|
+
const voice = inst.slot('search-voice', () => ({ current: null, all: new Set() }));
|
|
440
|
+
const me = {};
|
|
441
|
+
voice.all.add(me);
|
|
442
|
+
if (!voice.current) voice.current = me;
|
|
443
|
+
for (const field of fields) scope.listen(own(field.input), 'focus', () => { voice.current = me; });
|
|
444
|
+
scope.own(() => { voice.all.delete(me); if (voice.current === me) voice.current = null; });
|
|
445
|
+
scope.on('search:status', (text) => {
|
|
446
|
+
if (!voice.current) voice.current = me;
|
|
447
|
+
for (const id of ['search-status', 'mobile-search-status']) { const el = own(id); if (el) el.textContent = voice.current === me ? text : ''; }
|
|
448
|
+
});
|
|
449
|
+
// ... and the other one shows what this one typed or chose (cornfield's page has one search: nothing here runs there)
|
|
450
|
+
scope.on('search', () => {
|
|
451
|
+
if (voice.all.size < 2 || made.some((el) => el.contains(inst.active()))) return;
|
|
452
|
+
for (const field of fields) {
|
|
453
|
+
const input = own(field.input);
|
|
454
|
+
if (input && input.value.trim() !== state.searchQuery) input.value = state.searchQuery;
|
|
455
|
+
}
|
|
456
|
+
paintSearch({ keepOpen: false });
|
|
428
457
|
});
|
|
429
458
|
|
|
430
459
|
// What the neighbours ask of the search, and a layer going on or off moving matches between the list and "In layers that are off"
|
|
@@ -443,6 +472,8 @@ export function mount(root, inst, options = {}) {
|
|
|
443
472
|
searchActive,
|
|
444
473
|
paintSearch,
|
|
445
474
|
toggleMobileSearch,
|
|
475
|
+
/** The focus goes to the field, its text selected (what `/` does) */
|
|
476
|
+
focusField() { const input = own('node-search'); if (input) { input.focus(); input.select(); } },
|
|
446
477
|
/** For tests: forget what was found */
|
|
447
478
|
reset() { memo = null; chosen++; state.searchQuery = ''; state.searchCurrent = null; },
|
|
448
479
|
update(props) {
|
package/explorer/scene.js
CHANGED
|
@@ -178,7 +178,7 @@ import { hasGlyph } from './glyphs.js';
|
|
|
178
178
|
import { outageFor, paintOutage } from './outage-model.js';
|
|
179
179
|
import { paintForge } from './forge-panel-model.js';
|
|
180
180
|
import { lightColor, lightenScene, parseColor } from './theme-model.js';
|
|
181
|
-
import { matchIds } from './search-
|
|
181
|
+
import { matchIds } from './search-match.js';
|
|
182
182
|
import { nodeColor } from './css-color.js';
|
|
183
183
|
import { activeSubgraph, kindEdgeWord } from './selection-model.js';
|
|
184
184
|
import { DIFF_MARK_COLORS, DIFF_LABEL_ALPHA, GREY_ALPHA, GREY_LABEL_ALPHA, EDGE_MIN_ALPHA, MARK_SHAPES, REMOVED_ALPHA } from './diff-marks.js';
|