@popcorn245/cornfield 0.46.2 → 0.48.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 +6 -6
- package/explorer/css/account.css +46 -0
- package/explorer/css/base.css +159 -0
- package/explorer/css/changes.css +160 -0
- package/explorer/css/decision.css +68 -0
- package/explorer/css/dialogs.css +50 -0
- package/explorer/css/header.css +75 -0
- package/explorer/css/layers.css +92 -0
- package/explorer/css/live.css +48 -0
- package/explorer/css/map.css +43 -0
- package/explorer/css/node-panel.css +188 -0
- package/explorer/css/page.css +83 -0
- package/explorer/css/proposal.css +151 -0
- package/explorer/css/search.css +84 -0
- package/explorer/css/sheets.css +134 -0
- package/explorer/css/whatif.css +55 -0
- package/explorer/css/work.css +288 -0
- package/explorer/engine/hint.js +1 -0
- package/explorer/engine/keyboard.js +2 -2
- package/explorer/engine/map-style.js +9 -4
- package/explorer/flow-build.js +88 -0
- package/explorer/flows.js +1 -81
- package/explorer/focus-room.js +1 -1
- package/explorer/header-fit.js +3 -3
- package/explorer/house.css +1 -1
- package/explorer/index.html +20 -10
- package/explorer/input.js +8 -1
- package/explorer/page-pieces.js +5 -0
- package/explorer/page.js +11 -20
- package/explorer/pieces/adopt-tokens.js +38 -0
- package/explorer/pieces/map-stage.css +14 -0
- package/explorer/pieces/map.js +332 -0
- package/explorer/renderer.js +1 -0
- package/explorer/review.js +1 -1
- package/explorer/theme-model.js +1 -1
- package/explorer/theme.js +1 -1
- package/explorer/tokens.css +2 -2
- package/package.json +1 -1
- package/server/components.js +144 -0
- package/server/embed.js +3 -1
- package/server/server.js +9 -1
- package/explorer/explorer.css +0 -1512
package/explorer/index.html
CHANGED
|
@@ -7,9 +7,24 @@
|
|
|
7
7
|
<!-- The server puts the config's import map here (server/server.js), for a repo-local source's bare imports -->
|
|
8
8
|
<!--@importmap-->
|
|
9
9
|
|
|
10
|
-
<!-- The explorer's own stylesheet and modules (explorer/): no build step, no CDN -->
|
|
10
|
+
<!-- The explorer's own stylesheets (explorer/css/, one per piece: base.css first, page.css, the page's own, last; in an order that keeps the one explorer.css's cascade: test/explorer/stylesheet-split.test.js holds it) and modules (explorer/): no build step, no CDN -->
|
|
11
11
|
<link rel="stylesheet" href="/explorer/tokens.css" />
|
|
12
|
-
<link rel="stylesheet" href="/explorer/
|
|
12
|
+
<link rel="stylesheet" href="/explorer/css/base.css" />
|
|
13
|
+
<link rel="stylesheet" href="/explorer/css/header.css" />
|
|
14
|
+
<link rel="stylesheet" href="/explorer/css/layers.css" />
|
|
15
|
+
<link rel="stylesheet" href="/explorer/css/search.css" />
|
|
16
|
+
<link rel="stylesheet" href="/explorer/css/account.css" />
|
|
17
|
+
<link rel="stylesheet" href="/explorer/css/live.css" />
|
|
18
|
+
<link rel="stylesheet" href="/explorer/css/map.css" />
|
|
19
|
+
<link rel="stylesheet" href="/explorer/css/node-panel.css" />
|
|
20
|
+
<link rel="stylesheet" href="/explorer/css/proposal.css" />
|
|
21
|
+
<link rel="stylesheet" href="/explorer/css/changes.css" />
|
|
22
|
+
<link rel="stylesheet" href="/explorer/css/decision.css" />
|
|
23
|
+
<link rel="stylesheet" href="/explorer/css/whatif.css" />
|
|
24
|
+
<link rel="stylesheet" href="/explorer/css/dialogs.css" />
|
|
25
|
+
<link rel="stylesheet" href="/explorer/css/sheets.css" />
|
|
26
|
+
<link rel="stylesheet" href="/explorer/css/work.css" />
|
|
27
|
+
<link rel="stylesheet" href="/explorer/css/page.css" />
|
|
13
28
|
<link rel="stylesheet" href="/explorer/house.css" />
|
|
14
29
|
<!-- The config's brand (server/server.js puts it here): the favicon, the web app manifest and the tab colour -->
|
|
15
30
|
<!--@brand-->
|
|
@@ -171,13 +186,8 @@
|
|
|
171
186
|
|
|
172
187
|
<!-- The map -->
|
|
173
188
|
<div class="hx-stage" role="main" data-corn="stage">
|
|
174
|
-
<!-- The map
|
|
175
|
-
|
|
176
|
-
<p id="map-keys-help" class="hx-sr-only">Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Enter goes to the selected node's panel, Escape closes it. In Freeform, Alt and an arrow moves the selected node.</p>
|
|
177
|
-
<!-- What the keyboard landed on, said by a screen reader (keyboard.js) -->
|
|
178
|
-
<p id="map-announcer" class="hx-sr-only" role="status" aria-live="polite"></p>
|
|
179
|
-
<!-- Every label, drawn on its own transparent canvas over the map (explorer/labels.js); the map canvas still gets the pointer -->
|
|
180
|
-
<canvas id="label-canvas" aria-hidden="true" data-corn="label-canvas"></canvas>
|
|
189
|
+
<!-- The map: its canvas (focusable, its keys read out with its name), the help for its keys, the announcer the keyboard speaks in and the canvas its labels are drawn on, made here by explorer/pieces/map.js -->
|
|
190
|
+
<!--corn-piece:map/stage-->
|
|
181
191
|
<!-- The nodes agent runs are changing, marked over the map (explorer/runs-map.js): a picture; the Runs view says the same in words -->
|
|
182
192
|
<div id="run-overlay" class="hx-run-overlay" aria-hidden="true" hidden data-corn="run-overlay"></div>
|
|
183
193
|
|
|
@@ -204,7 +214,7 @@
|
|
|
204
214
|
<div class="hx-proposal-tools">
|
|
205
215
|
<!-- Shown only while there are what-if edits: off, the map is the proposal as written; the edits are kept and still go with a review (whatif.js) -->
|
|
206
216
|
<!-- The review narrows the map to the change; this puts the whole map back, as Diff always was (layers.js setWholeMap). Off at every opening -->
|
|
207
|
-
<!-- Its words are "Whole map", which read right pressed or not; its name and tooltip are the full "Show the whole map". On a desk it sits beside the title, so the bar keeps its rows (
|
|
217
|
+
<!-- Its words are "Whole map", which read right pressed or not; its name and tooltip are the full "Show the whole map". On a desk it sits beside the title, so the bar keeps its rows (css/proposal.css) -->
|
|
208
218
|
<button data-corn="whole-map" data-corn-kind="secondary" type="button" id="proposal-whole" class="hx-btn" data-action="proposal-whole" aria-pressed="false" aria-label="Show the whole map" title="Show the whole map" data-peek-ok data-corn-string="wholeMap" data-corn-string-aria-label="showWholeMap">Whole map</button>
|
|
209
219
|
<button data-corn-kind="secondary" type="button" id="proposal-myedits" class="hx-btn" aria-pressed="true" data-peek-ok data-corn-string="myEdits" hidden>My edits</button>
|
|
210
220
|
<button data-corn-kind="secondary" type="button" id="proposal-edit" class="hx-btn" aria-expanded="false" aria-controls="whatif" title="Try a change: add a node or an edge, reword a scenario">Edit</button>
|
package/explorer/input.js
CHANGED
|
@@ -51,10 +51,13 @@ export function bindCanvasInput(inst) {
|
|
|
51
51
|
|
|
52
52
|
const canDragNodes = () => state.isFreeform && state.view === 'orbit';
|
|
53
53
|
|
|
54
|
+
/** Where the pointer is, in the map's own pixels: the canvas's box on the screen may be scaled (a transform or `zoom` on an ancestor in a host's page) */
|
|
54
55
|
function getPointerPos(e) {
|
|
55
56
|
const rect = state.canvas.getBoundingClientRect();
|
|
56
57
|
const point = e.touches ? e.touches[0] : e;
|
|
57
|
-
|
|
58
|
+
const sx = rect.width && state.width ? state.width / rect.width : 1;
|
|
59
|
+
const sy = rect.height && state.height ? state.height / rect.height : 1;
|
|
60
|
+
return { x: (point.clientX - rect.left) * sx, y: (point.clientY - rect.top) * sy };
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
// The topology node with this id (the grid answers with scene nodes, which are copies of the picture)
|
|
@@ -216,7 +219,11 @@ export function bindCanvasInput(inst) {
|
|
|
216
219
|
|
|
217
220
|
|
|
218
221
|
const { canvas } = state;
|
|
222
|
+
// In another app's page (a root that is not the document) the wheel is the page's until the map is asked for it: the map has the focus
|
|
223
|
+
// (a click or Tab put it there), or Ctrl or Cmd is held (a trackpad's pinch comes so). A pointer passing over the map does not stop the page scrolling.
|
|
224
|
+
const embedded = !(inst.root && inst.root.nodeType === 9);
|
|
219
225
|
const onWheel = (e) => {
|
|
226
|
+
if (embedded && !e.ctrlKey && !e.metaKey && inst.active() !== state.canvas) return;
|
|
220
227
|
e.preventDefault();
|
|
221
228
|
stopFlight();
|
|
222
229
|
const p = getPointerPos(e);
|
package/explorer/page-pieces.js
CHANGED
|
@@ -35,6 +35,11 @@ function markersOf(doc, name) {
|
|
|
35
35
|
return found;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
/** The places of a piece the page mounts itself (the map: page.js), by slot: `{ stage: Comment }` */
|
|
39
|
+
export function pieceSlots(name) {
|
|
40
|
+
return markersOf(pageInstance().doc, name);
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
/** Mounts each piece at its places in the document, or again where the places were replaced; ends one whose places are gone. Returns the handles by name. */
|
|
39
44
|
export function ensurePagePieces() {
|
|
40
45
|
const inst = pageInstance();
|
package/explorer/page.js
CHANGED
|
@@ -29,19 +29,17 @@
|
|
|
29
29
|
|
|
30
30
|
import { state, startPageInstance } from './state.js';
|
|
31
31
|
import { createMap } from './engine/render.js';
|
|
32
|
-
import {
|
|
32
|
+
import { rendererPreference } from './renderer.js';
|
|
33
33
|
import { clearFreeformPositions, layoutOrbit, loadFreeformPositions } from './engine/layout.js';
|
|
34
34
|
import { measureCovered } from './sheets.js';
|
|
35
|
-
import { stopFlight } from './fly.js';
|
|
36
35
|
import { setProjectLayers } from './layers.js';
|
|
37
36
|
import { closeDrawer } from './panels.js';
|
|
38
|
-
import {
|
|
39
|
-
import { ensurePagePieces } from './page-pieces.js';
|
|
37
|
+
import { ensurePagePieces, pieceSlots } from './page-pieces.js';
|
|
40
38
|
import { initScenarioUi, maybeStartDemo, playOutage } from './scenario-ui.js';
|
|
41
39
|
import { initSheets } from './sheets.js';
|
|
42
40
|
import { initReviewColumn } from './review-column.js';
|
|
43
41
|
import { loadTopology, setView, syncViewUi } from './view.js';
|
|
44
|
-
import {
|
|
42
|
+
import { mount as mountMap, KEYS_HELP_WITH_PANEL } from './pieces/map.js';
|
|
45
43
|
import { initProposals } from './proposal.js';
|
|
46
44
|
import { followDeepLink } from './deep-link.js';
|
|
47
45
|
import { initWhatIf } from './whatif.js';
|
|
@@ -173,28 +171,21 @@ export function startPage() {
|
|
|
173
171
|
map = createMap(inst, { measureCovered }); // the camera, the scene and the frame loop of this instance (engine/render.js)
|
|
174
172
|
const mapStyle = mapStyleOf(inst);
|
|
175
173
|
initTheme(); // light or dark, before the first scene is built (theme.js)
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
map.setRenderer(createRenderer(state.canvas, { prefer: rendererPreference(window.location.search), mapStyle: mapStyle.get }));
|
|
174
|
+
// The map piece (pieces/map.js, also what <corn-map> mounts) makes the map's canvases, their keys' help and the announcer where index.html keeps
|
|
175
|
+
// `<!--corn-piece:map/stage-->`. It watches the theme's tokens (the map reads --corn-map-* from the theme, and again when it changes), makes the
|
|
176
|
+
// renderer (WebGL2, or Canvas 2D when it is missing or the address says ?renderer=canvas2d: the address is read here, not by the renderer), binds
|
|
177
|
+
// the canvas and its keys (engine/keyboard.js), follows the box's size, and answers a tap (a node's panel, the normal view, the end of a flight)
|
|
178
|
+
mountMap(document.body, inst, {
|
|
179
|
+
slots: pieceSlots('map'), measureCovered, keysHelp: KEYS_HELP_WITH_PANEL,
|
|
180
|
+
renderer: rendererPreference(window.location.search) === 'canvas2d' ? 'canvas2d' : 'auto',
|
|
181
|
+
});
|
|
185
182
|
loadFreeformPositions(inst);
|
|
186
183
|
ensurePagePieces(); // the node panel, the Layers menu and the search, mounted where index.html has their places (page-pieces.js)
|
|
187
|
-
// What a tap on the map asks of the page: a node's panel, the normal view, the end of a flight to a match
|
|
188
|
-
inst.on('select', (node) => selectNode(inst, node, { source: 'tap' }));
|
|
189
|
-
inst.on('background', () => clearSelection(inst, { source: 'tap' }));
|
|
190
|
-
inst.on('grab', () => stopFlight());
|
|
191
|
-
bindCanvasInput(inst);
|
|
192
184
|
initKeyboard(); // the map by keyboard (the panel's, the Layers menu's and the search's keys are their pieces') (engine/keyboard.js)
|
|
193
185
|
initAccountMenu(); // the one menu at the right of the header (account-menu.js)
|
|
194
186
|
initSheets();
|
|
195
187
|
initScenarioUi();
|
|
196
188
|
initReviewColumn(); // the review column: the changes, and the personas with their scenarios (review-column.js)
|
|
197
|
-
map.watchSize(); // the map follows its box (a ResizeObserver on the stage), in place of the window's resize event
|
|
198
189
|
|
|
199
190
|
map.resize();
|
|
200
191
|
syncViewUi();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/pieces/adopt-tokens
|
|
3
|
+
*
|
|
4
|
+
* The default `--corn-*` tokens for a page that has no cornfield stylesheet of its own (spec 0011 D7). The package generates the sheet from
|
|
5
|
+
* explorer/tokens.css at build time, with every selector at zero specificity (`:where(...)`), so any ordinary rule of the host's overrides it; the
|
|
6
|
+
* first `corn-*` element to connect hands its text to this, and it is added once to the document (and once to a shadow root the element sits in).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Marks the sheet this module made, so a second copy of the package on the same page finds it and adds nothing */
|
|
10
|
+
const MARK = Symbol.for('cornfield.default-tokens');
|
|
11
|
+
const ATTR = 'data-corn-default-tokens';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Adds `css` to the root node the element is in (a document or a shadow root), once. Returns true when it added it.
|
|
15
|
+
* Uses `adoptedStyleSheets`; a browser without it gets a `<style>` placed first in the head (or the shadow root), which loses to every later rule the same way.
|
|
16
|
+
* @param {Document|ShadowRoot} rootNode `element.getRootNode()`
|
|
17
|
+
* @param {string} css the generated default tokens
|
|
18
|
+
*/
|
|
19
|
+
export function adoptDefaultTokens(rootNode, css) {
|
|
20
|
+
if (!rootNode || !css) return false;
|
|
21
|
+
const doc = rootNode.nodeType === 9 ? rootNode : rootNode.ownerDocument;
|
|
22
|
+
const sheets = rootNode.adoptedStyleSheets;
|
|
23
|
+
if (Array.isArray(sheets) && doc && doc.defaultView && typeof doc.defaultView.CSSStyleSheet === 'function' && 'replaceSync' in doc.defaultView.CSSStyleSheet.prototype) {
|
|
24
|
+
if (sheets.some((s) => s && s[MARK])) return false;
|
|
25
|
+
const sheet = new doc.defaultView.CSSStyleSheet();
|
|
26
|
+
sheet.replaceSync(css);
|
|
27
|
+
sheet[MARK] = true;
|
|
28
|
+
rootNode.adoptedStyleSheets = [...sheets, sheet];
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
const holder = rootNode.nodeType === 9 ? rootNode.head : rootNode;
|
|
32
|
+
if (!holder || holder.querySelector(`style[${ATTR}]`)) return false;
|
|
33
|
+
const style = doc.createElement('style');
|
|
34
|
+
style.setAttribute(ATTR, '');
|
|
35
|
+
style.textContent = css;
|
|
36
|
+
holder.prepend(style);
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* The map piece's own box, for a shadow root (explorer/pieces/map.js; components/src/corn-map). cornfield's page styles the same
|
|
2
|
+
elements from explorer/css/ (#graph-canvas, .hx-stage), so nothing here loads there. Every colour is a --corn-* token; a host
|
|
3
|
+
restyles an element with ::part(map-stage), ::part(map-canvas), ::part(label-canvas). */
|
|
4
|
+
/* As tall as the host makes it, and never under 16rem: a map dropped in with no height is visible. A host that wants it lower says so on the
|
|
5
|
+
part: corn-map::part(map-stage) { min-height: 0 } */
|
|
6
|
+
[data-corn="map-stage"] { display: block; position: relative; width: 100%; height: 100%; min-height: 16rem; overflow: hidden; background: var(--corn-ground-image), var(--corn-ground); }
|
|
7
|
+
/* The canvas is out of flow: its own pixel size (set by the renderer) must not become the element's minimum width in a grid or a flex row */
|
|
8
|
+
[data-corn="map-canvas"] { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
|
|
9
|
+
[data-corn="map-canvas"]:active { cursor: grabbing; }
|
|
10
|
+
[data-corn="map-canvas"]:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: calc(var(--corn-focus-width) * -1); }
|
|
11
|
+
[data-corn="label-canvas"] { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
|
|
12
|
+
/* The Canvas 2D that stands in for the map canvas when its WebGL2 shaders fail (renderer.js): same place, pointer goes through */
|
|
13
|
+
[data-corn="map-overlay"] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
|
|
14
|
+
.hx-sr-only { position: absolute !important; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/pieces/map
|
|
3
|
+
*
|
|
4
|
+
* The map as a piece (spec 0011 D3): its two canvases, the help for its keys and its announcer, made, wired and ended in one place, for cornfield's
|
|
5
|
+
* own page (explorer/page.js mounts it where index.html keeps `<!--corn-piece:map/stage-->`) and for the `<corn-map>` component (components/src,
|
|
6
|
+
* which mounts it in its shadow root). There is one code path: the keys are engine/keyboard.js's, a tap selects through engine/selection.js, and
|
|
7
|
+
* the page and a component differ only in who listens to the instance's events (the page's node panel follows `node:show`; a component turns
|
|
8
|
+
* `selection` into `cornSelect`).
|
|
9
|
+
*
|
|
10
|
+
* const piece = mount(root, inst, options) -> { update, destroy, ... }
|
|
11
|
+
*
|
|
12
|
+
* root where the piece's elements go when `options.slots` names no place: an element or a shadow root (they go in a stage of their own there)
|
|
13
|
+
* inst the instance (instance.js) the map runs on; null makes one over `root`, which `destroy()` then ends too
|
|
14
|
+
* options see below; `update(next)` takes the same keys and applies what changed
|
|
15
|
+
*
|
|
16
|
+
* Options, all optional:
|
|
17
|
+
* topology {nodes, edges}: the map to draw (the object topology.json holds). The page does not pass it: it fetches and fills the state itself (view.js)
|
|
18
|
+
* view 'map' | 'dataflow'
|
|
19
|
+
* node the id of the selected node, or null/'' for none. A node the map has not got yet is selected when a topology brings it
|
|
20
|
+
* theme 'light' | 'dark' | 'auto': the ground the map is drawn for. 'auto' (and nothing) follows the document's own `data-theme`, else prefers-color-scheme
|
|
21
|
+
* renderer 'auto' | 'canvas2d'
|
|
22
|
+
* base, fetch, strings for a piece that makes its own instance
|
|
23
|
+
* slots { stage: Node }: the place the elements go before (cornfield's page: the marker in its stage). Without it they go in a stage of their own in `root`
|
|
24
|
+
* keysHelp the words the canvas is described by; default KEYS_HELP. cornfield's page, which has the node panel and Freeform, says KEYS_HELP_WITH_PANEL
|
|
25
|
+
* tokens the default `--corn-*` tokens (CSS text) to add, once, to the document, and to the shadow root the map's host is in if it is in one (adopt-tokens.js)
|
|
26
|
+
* measureCovered () => px of the bottom of the map something covers (the page's phone sheets); default none
|
|
27
|
+
* onSelect ({ id, kind, source, from?, to? }) once per change of the selection, from the instance's `selection` event, whoever made it:
|
|
28
|
+
* kind 'node' (id: the node's), 'edge' (id: 'from->to', and from, to), or null with id null (cleared); source as the event says
|
|
29
|
+
* onReady () once, after the first frame with a map in it is drawn
|
|
30
|
+
*
|
|
31
|
+
* What it does for a root that is not the document (the traps in test/explorer/piece-map.test.js):
|
|
32
|
+
* a drag released outside the root ends (pointer capture on the canvas), theme icons are fetched with CORS when the instance has a base,
|
|
33
|
+
* a change of theme reads the tokens again (`refresh()`), freeform positions are never stored, and `destroy()` always ends the instance's map.
|
|
34
|
+
*
|
|
35
|
+
* It imports the instance and the engine, and none of the bridges (state.js, render.js, map-style.js, layout.js): see instance-tripwires.test.js.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
import { createInstance } from '../instance.js';
|
|
39
|
+
import { createMap } from '../engine/render.js';
|
|
40
|
+
import { mapStyleOf } from '../engine/map-style.js';
|
|
41
|
+
import { computeDegreeCentrality, computeLaneLayout, layoutOrbit } from '../engine/layout.js';
|
|
42
|
+
import { initKeyboard, resetKeyboard } from '../engine/keyboard.js';
|
|
43
|
+
import { selectNode, clearSelection } from '../engine/selection.js';
|
|
44
|
+
import { stopFlight } from '../engine/fly.js';
|
|
45
|
+
import { scopeOf, place } from '../engine/piece.js';
|
|
46
|
+
import { createRenderer } from '../renderer.js';
|
|
47
|
+
import { bindCanvasInput } from '../input.js';
|
|
48
|
+
import { buildDataFlow } from '../flow-build.js';
|
|
49
|
+
import { resolveTheme } from '../theme-model.js';
|
|
50
|
+
import { escapeHtml } from '../../core/text.js';
|
|
51
|
+
import { adoptDefaultTokens } from './adopt-tokens.js';
|
|
52
|
+
|
|
53
|
+
/** The keys of a map on its own (engine/keyboard.js): what the canvas is described by */
|
|
54
|
+
export const KEYS_HELP = 'Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Escape clears the selection.';
|
|
55
|
+
/** The same keys where the map has the node panel and Freeform beside it (cornfield's page) */
|
|
56
|
+
export const KEYS_HELP_WITH_PANEL = "Arrow keys pan, plus and minus zoom, 0 fits the map. N and P select the next and the previous node, Home and End the first and the last. F frames the selected node and what it lights. Enter goes to the selected node's panel, Escape closes it. In Freeform, Alt and an arrow moves the selected node.";
|
|
57
|
+
|
|
58
|
+
/** The map canvas: one per mount, and one per change of renderer (a canvas that gave a WebGL context can never give a 2d one) */
|
|
59
|
+
const CANVAS = '<canvas id="graph-canvas" data-corn="map-canvas" tabindex="0" role="application" aria-roledescription="map" aria-label="Topology map" aria-describedby="map-keys-help"></canvas>';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The markup of the piece (`stage`): the map canvas, the help for its keys, the announcer the keyboard speaks in (engine/keyboard.js), and the
|
|
63
|
+
* canvas the labels are drawn on (labels.js) over the map; the map canvas still gets the pointer. Hooks get their parts when placed (engine/piece.js).
|
|
64
|
+
* @param {{ keysHelp?: string }} [opts]
|
|
65
|
+
*/
|
|
66
|
+
export const markup = ({ keysHelp = KEYS_HELP } = {}) => ({
|
|
67
|
+
stage: `${CANVAS}
|
|
68
|
+
<p id="map-keys-help" class="hx-sr-only">${escapeHtml(keysHelp)}</p>
|
|
69
|
+
<p id="map-announcer" class="hx-sr-only" role="status" aria-live="polite"></p>
|
|
70
|
+
<canvas id="label-canvas" data-corn="label-canvas" aria-hidden="true"></canvas>`,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
/** The document or shadow root the map's host sits in: where the default tokens go */
|
|
74
|
+
function hostRootOf(root) {
|
|
75
|
+
const host = root.nodeType === 11 ? /** @type {ShadowRoot} */ (root).host : root;
|
|
76
|
+
return host && typeof host.getRootNode === 'function' ? host.getRootNode() : null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {Element|ShadowRoot} root
|
|
81
|
+
* @param {ReturnType<typeof createInstance>|null} inst
|
|
82
|
+
* @param {object} [options]
|
|
83
|
+
*/
|
|
84
|
+
export function mount(root, inst, options = {}) {
|
|
85
|
+
const ownsInstance = !inst;
|
|
86
|
+
if (ownsInstance) inst = createInstance({ root, base: options.base || '', fetch: options.fetch, strings: options.strings });
|
|
87
|
+
const { state } = inst;
|
|
88
|
+
if (options.tokens) {
|
|
89
|
+
// The defaults go on the document, whose :root every element inherits from (through every shadow root); where the map's host sits in a
|
|
90
|
+
// shadow root of the page's own, that root gets the sheet too, for the rules on the element's `theme` attribute, which match only there
|
|
91
|
+
const where = hostRootOf(root);
|
|
92
|
+
if (where) adoptDefaultTokens(where.nodeType === 9 ? where : where.ownerDocument, options.tokens);
|
|
93
|
+
if (where && where.nodeType === 11) adoptDefaultTokens(where, options.tokens);
|
|
94
|
+
}
|
|
95
|
+
/** What the piece set up, undone by destroy() (the instance's own end runs it too, if the piece is still there) */
|
|
96
|
+
const scope = scopeOf(inst);
|
|
97
|
+
const rendererOf = (v) => (v === 'canvas2d' ? 'canvas2d' : 'auto');
|
|
98
|
+
const themeOf = (v) => (v === 'light' || v === 'dark' ? v : 'auto');
|
|
99
|
+
const current = { renderer: rendererOf(options.renderer), theme: themeOf(options.theme), topology: undefined };
|
|
100
|
+
let ended = false;
|
|
101
|
+
let ready = false;
|
|
102
|
+
|
|
103
|
+
// -- elements ---------------------------------------------------------------------------------------------------------------------
|
|
104
|
+
const html = markup({ keysHelp: options.keysHelp }).stage;
|
|
105
|
+
const slots = options.slots && options.slots.stage ? options.slots : null;
|
|
106
|
+
const made = place(inst, root, slots ? html : `<div data-corn="map-stage">${html}</div>`, slots, 'stage');
|
|
107
|
+
const find = (sel) => made.map((el) => (el.matches(sel) ? el : el.querySelector(sel))).find(Boolean);
|
|
108
|
+
scope.own(() => { for (const el of [...made, state.canvas]) if (el) el.remove(); });
|
|
109
|
+
|
|
110
|
+
// -- what the engine needs on the state, in this order ------------------------------------------------------------------------------
|
|
111
|
+
state.canvas = find('[data-corn="map-canvas"]');
|
|
112
|
+
state.labelCanvas = find('[data-corn="label-canvas"]');
|
|
113
|
+
// A 2d context that only measures text (layout.js labelWidth): the map canvas may be WebGL, and a canvas that gave WebGL can never give 2d
|
|
114
|
+
state.ctx = inst.doc.createElement('canvas').getContext('2d');
|
|
115
|
+
const map = createMap(inst, options.measureCovered ? { measureCovered: options.measureCovered } : {});
|
|
116
|
+
const style = mapStyleOf(inst);
|
|
117
|
+
scope.own(style.watch());
|
|
118
|
+
scope.own(style.onChange(() => map.render()));
|
|
119
|
+
const prefer = () => (current.renderer === 'canvas2d' ? 'canvas2d' : null);
|
|
120
|
+
const installRenderer = () => map.setRenderer(createRenderer(state.canvas, { prefer: prefer(), mapStyle: style.get }));
|
|
121
|
+
|
|
122
|
+
// -- the ground: light or dark ------------------------------------------------------------------------------------------------------
|
|
123
|
+
const lightQuery = inst.win && inst.win.matchMedia ? inst.win.matchMedia('(prefers-color-scheme: light)') : null;
|
|
124
|
+
/** The mode the map is drawn for: the element's own `theme`, else the document's `data-theme`, else the system's */
|
|
125
|
+
function mode() {
|
|
126
|
+
if (current.theme === 'light' || current.theme === 'dark') return current.theme;
|
|
127
|
+
const root$ = inst.doc && inst.doc.documentElement;
|
|
128
|
+
const own = root$ ? root$.getAttribute('data-theme') : null;
|
|
129
|
+
if (own === 'light' || own === 'dark') return own;
|
|
130
|
+
return resolveTheme('system', !!(lightQuery && lightQuery.matches));
|
|
131
|
+
}
|
|
132
|
+
/** Draws for the mode now in force and reads the tokens again (they differ by mode, and the host's `<html>` and head are not watched by the style) */
|
|
133
|
+
function refresh() {
|
|
134
|
+
if (ended) return;
|
|
135
|
+
const next = mode();
|
|
136
|
+
style.refresh();
|
|
137
|
+
if (state.theme !== next) { state.theme = next; inst.touchScene(); }
|
|
138
|
+
map.render();
|
|
139
|
+
}
|
|
140
|
+
state.theme = mode();
|
|
141
|
+
if (lightQuery && lightQuery.addEventListener) { lightQuery.addEventListener('change', refresh); scope.own(() => lightQuery.removeEventListener('change', refresh)); }
|
|
142
|
+
const Mutation = inst.win && inst.win.MutationObserver;
|
|
143
|
+
if (Mutation && inst.doc && inst.doc.documentElement) { // the host page switching its own light and dark
|
|
144
|
+
const watch = new Mutation(refresh);
|
|
145
|
+
watch.observe(inst.doc.documentElement, { attributes: true, attributeFilter: ['data-theme', 'class'] });
|
|
146
|
+
scope.own(() => watch.disconnect());
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// -- the renderer, the layout --------------------------------------------------------------------------------------------------------
|
|
150
|
+
installRenderer();
|
|
151
|
+
|
|
152
|
+
/** Where nodes sit for the current view */
|
|
153
|
+
function applyLayout() {
|
|
154
|
+
computeDegreeCentrality(inst);
|
|
155
|
+
if (state.view === 'dataflow' && state.flow) {
|
|
156
|
+
state.flow.tiers.forEach((tier) => tier.nodes.forEach((n) => { n.r = Math.min(n.r, 13); })); // all small in the lanes
|
|
157
|
+
computeLaneLayout(inst, state.flow);
|
|
158
|
+
} else layoutOrbit(inst);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** A fit asked for while the map has no box (a parent `display: none`, a box of no size) waits for one: fitted to nothing, the camera would be lost */
|
|
162
|
+
let fitWhenSized = false;
|
|
163
|
+
const fit = () => {
|
|
164
|
+
if (!state.nodes.length) return;
|
|
165
|
+
fitWhenSized = !state.width || !state.height;
|
|
166
|
+
if (!fitWhenSized) map.fitGraphToViewport(map.fitPadding());
|
|
167
|
+
};
|
|
168
|
+
const nodeById = (id) => state.nodes.find((n) => n.id === id) || null;
|
|
169
|
+
|
|
170
|
+
// -- selection: one path for the page and a component ---------------------------------------------------------------------------------
|
|
171
|
+
/** A node the host asked for that the map has not got (yet): selected when a topology brings it */
|
|
172
|
+
let pendingNode = null;
|
|
173
|
+
// A tap on a node selects it, a tap on the bare map clears it, a hand on the camera ends a flight (input.js asks; engine/selection.js does)
|
|
174
|
+
scope.on('select', (node) => selectNode(inst, node, { source: 'tap' }));
|
|
175
|
+
scope.on('background', () => clearSelection(inst, { source: 'tap' }));
|
|
176
|
+
scope.on('grab', () => stopFlight(inst));
|
|
177
|
+
// The instance says each change once, whoever made it (a tap, a key, a search, `node`, an assignment to the state: an edge picked on a proposal)
|
|
178
|
+
scope.on('selection', ({ node, edge, source }) => {
|
|
179
|
+
if (ended) return;
|
|
180
|
+
if (node || edge) pendingNode = null;
|
|
181
|
+
if (!options.onSelect) return;
|
|
182
|
+
if (node) options.onSelect({ id: node.id, kind: 'node', source });
|
|
183
|
+
else if (edge) options.onSelect({ id: `${edge.from}->${edge.to}`, kind: 'edge', from: edge.from, to: edge.to, source });
|
|
184
|
+
else options.onSelect({ id: null, kind: null, source });
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
/** Selects the node with this id and brings it into view; false when the map has no such node */
|
|
188
|
+
function focusNode(id) {
|
|
189
|
+
const node = nodeById(String(id));
|
|
190
|
+
if (!node || ended) return false;
|
|
191
|
+
selectNode(inst, node, { frame: true, source: 'api' });
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// -- pointer and keys on the canvas ---------------------------------------------------------------------------------------------------
|
|
196
|
+
let stopInput = () => {};
|
|
197
|
+
const inDocument = !!inst.root && inst.root.nodeType === 9;
|
|
198
|
+
/** Binds the canvas now in `state.canvas`: map input, a mouse drag that follows the pointer out of the root, the keys. Once more when the canvas is replaced. */
|
|
199
|
+
function bind() {
|
|
200
|
+
const canvas = state.canvas;
|
|
201
|
+
const offs = [bindCanvasInput(inst)];
|
|
202
|
+
if (!inDocument) {
|
|
203
|
+
// input.js hears the release on the root, so a drag let go outside an element root would stick: the canvas holds the pointer until it is let go
|
|
204
|
+
offs.push(inst.listen(canvas, 'pointerdown', (e) => { if (e.pointerType === 'mouse' && canvas.setPointerCapture) { try { canvas.setPointerCapture(e.pointerId); } catch { /* the pointer is gone */ } } }));
|
|
205
|
+
}
|
|
206
|
+
resetKeyboard(inst); // the keys are the canvas's (engine/keyboard.js): a new canvas takes them over
|
|
207
|
+
initKeyboard(inst);
|
|
208
|
+
offs.push(() => resetKeyboard(inst));
|
|
209
|
+
stopInput = () => offs.forEach((off) => off());
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// -- the first frame ---------------------------------------------------------------------------------------------------------------------
|
|
213
|
+
scope.own(map.onPaint(() => {
|
|
214
|
+
if (fitWhenSized && state.width && state.height) fit();
|
|
215
|
+
if (ready || !state.nodes.length) return;
|
|
216
|
+
ready = true;
|
|
217
|
+
if (options.onReady) options.onReady();
|
|
218
|
+
}));
|
|
219
|
+
|
|
220
|
+
bind();
|
|
221
|
+
scope.own(() => stopInput());
|
|
222
|
+
scope.own(map.watchSize());
|
|
223
|
+
map.resize();
|
|
224
|
+
|
|
225
|
+
// -- changes ---------------------------------------------------------------------------------------------------------------------------------
|
|
226
|
+
function setTopology(topology) {
|
|
227
|
+
const nodes = topology && Array.isArray(topology.nodes) ? topology.nodes.filter((n) => n && typeof n.id === 'string') : [];
|
|
228
|
+
const edges = topology && Array.isArray(topology.edges) ? topology.edges.filter((e) => e && typeof e.from === 'string' && typeof e.to === 'string') : [];
|
|
229
|
+
const keep = state.selectedNode ? state.selectedNode.id : null; // the selection outlives a new topology that has its node
|
|
230
|
+
// The host's object is never changed: the map works on copies (the layout writes positions on them)
|
|
231
|
+
state.baseNodes = nodes;
|
|
232
|
+
state.baseEdges = edges;
|
|
233
|
+
state.nodes = nodes.map((n) => ({ ...n }));
|
|
234
|
+
state.edges = edges.map((e) => ({ ...e }));
|
|
235
|
+
state.mapNodes = state.nodes;
|
|
236
|
+
state.mapEdges = state.edges;
|
|
237
|
+
state.flow = buildDataFlow(state.nodes, state.edges);
|
|
238
|
+
const again = keep ? nodeById(keep) : null;
|
|
239
|
+
// The same id is the same selection (the instance says nothing); none is a change it says once
|
|
240
|
+
if (again) { state.selectedEdge = null; state.selectedNode = again; } else if (state.selectedNode || state.selectedEdge) { state.selectedNode = null; state.selectedEdge = null; }
|
|
241
|
+
inst.touchScene();
|
|
242
|
+
if (state.nodes.length) { applyLayout(); fit(); }
|
|
243
|
+
const asked = !again && pendingNode ? nodeById(pendingNode) : null; // the node the host asked for before the map had it
|
|
244
|
+
if (asked) selectNode(inst, asked, { source: 'api' });
|
|
245
|
+
map.render();
|
|
246
|
+
map.ensureFlowLoop();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function setView(view) {
|
|
250
|
+
const next = view === 'dataflow' ? 'dataflow' : 'orbit';
|
|
251
|
+
if (state.view === next) return;
|
|
252
|
+
state.view = next;
|
|
253
|
+
inst.touchScene();
|
|
254
|
+
if (state.nodes.length) { applyLayout(); fit(); map.ensureFlowLoop(); }
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** A canvas that has given a context cannot give the other kind: the map gets a new one, the old one gives its WebGL context back */
|
|
258
|
+
function replaceRenderer() {
|
|
259
|
+
const previous = map.getRenderer();
|
|
260
|
+
if (previous.release) previous.release(); else previous.destroy(); // before the swap: a renderer already destroyed does not give its context back
|
|
261
|
+
stopInput();
|
|
262
|
+
const holder = inst.doc.createElement('template');
|
|
263
|
+
holder.innerHTML = CANVAS;
|
|
264
|
+
const next = /** @type {HTMLCanvasElement} */ (holder.content.firstElementChild);
|
|
265
|
+
next.setAttribute('part', 'map-canvas');
|
|
266
|
+
const hadFocus = inst.active() === state.canvas;
|
|
267
|
+
state.canvas.replaceWith(next);
|
|
268
|
+
state.canvas = next;
|
|
269
|
+
bind();
|
|
270
|
+
installRenderer();
|
|
271
|
+
map.resize();
|
|
272
|
+
if (hadFocus) next.focus();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Applies what changed in `next` (the options above). Only the keys present are looked at.
|
|
277
|
+
* @param {object} [next]
|
|
278
|
+
*/
|
|
279
|
+
function update(next = {}) {
|
|
280
|
+
if (ended) return;
|
|
281
|
+
if ('renderer' in next) {
|
|
282
|
+
const value = rendererOf(next.renderer);
|
|
283
|
+
if (value !== current.renderer) { current.renderer = value; replaceRenderer(); }
|
|
284
|
+
}
|
|
285
|
+
if ('theme' in next) {
|
|
286
|
+
const value = themeOf(next.theme);
|
|
287
|
+
if (value !== current.theme) { current.theme = value; refresh(); }
|
|
288
|
+
}
|
|
289
|
+
if ('topology' in next && next.topology !== current.topology) { current.topology = next.topology; setTopology(next.topology); }
|
|
290
|
+
if ('view' in next) setView(next.view === 'dataflow' ? 'dataflow' : 'orbit');
|
|
291
|
+
if ('node' in next) {
|
|
292
|
+
const id = next.node == null || next.node === '' ? null : String(next.node);
|
|
293
|
+
if (id === null) {
|
|
294
|
+
pendingNode = null;
|
|
295
|
+
if (state.selectedNode || state.selectedEdge) clearSelection(inst, { source: 'api' });
|
|
296
|
+
} else {
|
|
297
|
+
const node = nodeById(id);
|
|
298
|
+
if (!node) pendingNode = id;
|
|
299
|
+
else if (!state.selectedNode || state.selectedNode.id !== id) selectNode(inst, node, { source: 'api' }); // the same node again changes nothing and says nothing
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/** Ends the piece: its listeners, observers and timers, its elements, and the map (the renderer gives its WebGL context back) */
|
|
305
|
+
function destroy() {
|
|
306
|
+
if (ended) return;
|
|
307
|
+
ended = true;
|
|
308
|
+
scope.destroy();
|
|
309
|
+
map.destroy();
|
|
310
|
+
if (ownsInstance) inst.destroy();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const first = {};
|
|
314
|
+
for (const key of ['topology', 'view', 'node']) if (options[key] !== undefined) first[key] = options[key];
|
|
315
|
+
update(first);
|
|
316
|
+
refresh();
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
inst,
|
|
320
|
+
map,
|
|
321
|
+
update,
|
|
322
|
+
destroy,
|
|
323
|
+
/** The whole map in view */
|
|
324
|
+
fit,
|
|
325
|
+
/** Selects a node by id and brings it into view; false when there is none */
|
|
326
|
+
focusNode,
|
|
327
|
+
/** Reads the tokens again and draws: for a change the style cannot see (the host's `<html>`, a stylesheet in its head) */
|
|
328
|
+
refresh,
|
|
329
|
+
/** Starts the theme's icons (`config.theme` of /cornfield/config.json), fetched with CORS when the instance has a base */
|
|
330
|
+
applyTheme: (theme) => style.applyTheme(theme),
|
|
331
|
+
};
|
|
332
|
+
}
|
package/explorer/renderer.js
CHANGED
|
@@ -42,6 +42,7 @@ function addStandIn(canvas) {
|
|
|
42
42
|
const standIn = canvas.ownerDocument.createElement('canvas');
|
|
43
43
|
standIn.className = 'hx-overlay';
|
|
44
44
|
standIn.setAttribute('data-corn', 'map-overlay');
|
|
45
|
+
standIn.setAttribute('part', 'map-overlay'); // a host styles it from outside a shadow root: every hook is a part too
|
|
45
46
|
standIn.setAttribute('aria-hidden', 'true');
|
|
46
47
|
canvas.after(standIn);
|
|
47
48
|
return standIn;
|
package/explorer/review.js
CHANGED
|
@@ -135,7 +135,7 @@ function mount() {
|
|
|
135
135
|
undo.hidden = true;
|
|
136
136
|
undo.textContent = t('undo');
|
|
137
137
|
// Before Approve, not after it: Approve keeps its place under the pointer, so the second click of a double click lands on the held
|
|
138
|
-
// button (which ignores it), never on Undo; on a phone Undo takes a row of its own under the two (
|
|
138
|
+
// button (which ignores it), never on Undo; on a phone Undo takes a row of its own under the two (css/decision.css)
|
|
139
139
|
const approve = actions.querySelector('[data-review="approved"]');
|
|
140
140
|
if (approve) approve.before(undo); else actions.append(undo);
|
|
141
141
|
}
|
package/explorer/theme-model.js
CHANGED
|
@@ -52,7 +52,7 @@ export function themeNameFrom(stored, names, fallback) {
|
|
|
52
52
|
/** Where a named theme's stylesheet is served (server/server.js); '' for no named theme */
|
|
53
53
|
export const themeNameHref = (name) => (/^[a-z0-9][a-z0-9-]{0,31}$/.test(name) ? `/cornfield/theme/${name}.css` : '');
|
|
54
54
|
|
|
55
|
-
/** The light page's ground (--hx-bg in
|
|
55
|
+
/** The light page's ground (--hx-bg, an alias of --corn-ground in tokens.css): what the light colours are measured against */
|
|
56
56
|
export const LIGHT_GROUND = '#f4f6fa';
|
|
57
57
|
/** The dark page's ground, for checking what the dark theme already does */
|
|
58
58
|
export const DARK_GROUND = '#090d16';
|
package/explorer/theme.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - the choice is `system` (the default: `prefers-color-scheme`, followed live), `light` or `dark`;
|
|
8
8
|
* the System / Dark / Light segment in the account menu sets it and keeps the choice in localStorage
|
|
9
9
|
* (THEME_STORAGE_KEY). `?theme=light|dark|system` in the address wins, for that visit, and is not kept;
|
|
10
|
-
* - the theme in force is `<html data-theme="light|dark">`:
|
|
10
|
+
* - the theme in force is `<html data-theme="light|dark">`: tokens.css swaps its tokens on it,
|
|
11
11
|
* theme-boot.js sets it before the first paint (so a light page never flashes dark), and this module
|
|
12
12
|
* keeps it right afterwards;
|
|
13
13
|
* - the map: `state.theme`, then `touchScene()`, so the next scene is built for the new ground (scene.js), and the map's
|
package/explorer/tokens.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
The explorer's design tokens (docs/theming.md)
|
|
3
3
|
==========================================================================
|
|
4
4
|
The ONLY file in explorer/ that holds a literal colour, font, size, radius, border width, shadow or spacing:
|
|
5
|
-
explorer
|
|
5
|
+
explorer/css/*.css and house.css read these `--corn-*` custom properties and nothing else (a test holds it,
|
|
6
6
|
test/explorer/tokens.test.js). A brand re-skins the explorer by loading a stylesheet after this one that
|
|
7
7
|
redefines some of them.
|
|
8
8
|
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
color-scheme: light;
|
|
313
313
|
}
|
|
314
314
|
|
|
315
|
-
/* A phone's density: controls are 44px tall (the target), and a panel pads by 16px under 640px.
|
|
315
|
+
/* A phone's density: controls are 44px tall (the target), and a panel pads by 16px under 640px. css/base.css floors a phone's control at 44px whatever
|
|
316
316
|
a brand sets (max(44px, …)); a brand that sets --corn-panel-pad on :root sets a phone's too, unless it sets it again under the same query */
|
|
317
317
|
@media (max-width: 767px) { :root { --corn-control-height: 44px; } }
|
|
318
318
|
@media (max-width: 639px) { :root { --corn-panel-pad: var(--corn-space-5); } }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcorn245/cornfield",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.48.0",
|
|
4
4
|
"description": "A self-hostable dev dashboard with the topology map at its centre: proposals on the map, scenarios, outages and what-if edits, for any repo.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "popcorn245 (https://github.com/popcorn245)",
|