@popcorn245/cornfield 0.26.0 → 0.28.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/config.js +7 -2
- package/core/contrast.js +1 -0
- package/core/strings.js +117 -0
- package/core/theme.js +85 -4
- package/core/validate.js +4 -2
- package/explorer/explorer.css +6 -3
- package/explorer/forge-panel.js +11 -10
- package/explorer/index.html +33 -33
- package/explorer/labels.js +13 -6
- package/explorer/main.js +4 -1
- package/explorer/map-style.js +428 -0
- package/explorer/panels.js +3 -2
- package/explorer/plugins.js +6 -2
- package/explorer/proposal.js +6 -2
- package/explorer/renderer-canvas2d.js +26 -5
- package/explorer/renderer-webgl.js +182 -38
- package/explorer/review.js +11 -5
- package/explorer/runs-view.js +6 -5
- package/explorer/scene.js +13 -2
- package/explorer/shaders.js +27 -0
- package/explorer/strings.js +68 -0
- package/explorer/theme.js +4 -1
- package/explorer/tokens.css +71 -0
- package/explorer/view.js +2 -1
- package/package.json +1 -1
- package/server/server.js +4 -1
package/explorer/index.html
CHANGED
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
</button>
|
|
33
33
|
|
|
34
34
|
<div class="hx-menu-wrap">
|
|
35
|
-
<button type="button" id="legend-toggle-btn" class="hx-btn" data-action="toggle-layers-menu" aria-label="Layers" aria-expanded="false" aria-controls="legend-dropdown" title="Toggle Architecture Layers" data-corn="layers-button">
|
|
35
|
+
<button type="button" id="legend-toggle-btn" class="hx-btn" data-action="toggle-layers-menu" aria-label="Layers" data-corn-string-aria-label="layers" aria-expanded="false" aria-controls="legend-dropdown" title="Toggle Architecture Layers" data-corn="layers-button">
|
|
36
36
|
<span class="hx-dots" aria-hidden="true">
|
|
37
37
|
<span style="background:#6366f1"></span><span style="background:#06b6d4"></span><span style="background:#38bdf8"></span><span style="background:#10b981"></span><span style="background:#a855f7"></span><span style="background:#ec4899"></span><span style="background:#fb923c"></span>
|
|
38
38
|
</span>
|
|
39
|
-
<span class="hx-only-wide">Layers</span>
|
|
39
|
+
<span class="hx-only-wide" data-corn-string="layers">Layers</span>
|
|
40
40
|
<span class="hx-faint" aria-hidden="true">▾</span>
|
|
41
41
|
</button>
|
|
42
42
|
|
|
@@ -89,31 +89,31 @@
|
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
91
|
<!-- The data-flow preset: browser -> servers -> API -> tables -> services -> outside, animated -->
|
|
92
|
-
<button type="button" id="preset-dataflow-btn" class="hx-btn hx-btn--preset" data-action="preset-dataflow" aria-pressed="false" aria-label="Data flow" title="Show only how data moves: browser, app servers, API, tables, services, outside systems" data-corn="preset-dataflow">
|
|
92
|
+
<button type="button" id="preset-dataflow-btn" class="hx-btn hx-btn--preset" data-action="preset-dataflow" aria-pressed="false" aria-label="Data flow" data-corn-string-aria-label="dataFlow" title="Show only how data moves: browser, app servers, API, tables, services, outside systems" data-corn="preset-dataflow">
|
|
93
93
|
<span aria-hidden="true">⇄</span>
|
|
94
|
-
<span class="hx-only-wide">Data flow</span>
|
|
94
|
+
<span class="hx-only-wide" data-corn-string="dataFlow">Data flow</span>
|
|
95
95
|
</button>
|
|
96
96
|
|
|
97
97
|
<!-- The House preset (explorer/house.js, spec 0029): the floor plan with its devices, machines and people, the software around it -->
|
|
98
|
-
<button type="button" id="preset-house-btn" class="hx-btn hx-btn--preset" data-action="preset-house" aria-pressed="false" aria-label="House" title="Show the house: each floor's rooms with their devices and machines, the people beside it, the software around it" data-corn="preset-house">
|
|
98
|
+
<button type="button" id="preset-house-btn" class="hx-btn hx-btn--preset" data-action="preset-house" aria-pressed="false" aria-label="House" data-corn-string-aria-label="house" title="Show the house: each floor's rooms with their devices and machines, the people beside it, the software around it" data-corn="preset-house">
|
|
99
99
|
<span aria-hidden="true">⌂</span>
|
|
100
|
-
<span class="hx-only-wide">House</span>
|
|
100
|
+
<span class="hx-only-wide" data-corn-string="house">House</span>
|
|
101
101
|
</button>
|
|
102
102
|
|
|
103
103
|
<!-- Proposals: what a change would add, change and remove, drawn on the map (proposal.js) -->
|
|
104
104
|
<div id="proposal-wrap" class="hx-menu-wrap">
|
|
105
|
-
<button type="button" id="proposal-btn" class="hx-btn hx-btn--proposal" data-action="toggle-proposals-menu" aria-haspopup="true" aria-expanded="false" aria-label="Proposals" title="Open a proposal: what a change would add, change and remove" data-corn="proposals-button">
|
|
105
|
+
<button type="button" id="proposal-btn" class="hx-btn hx-btn--proposal" data-action="toggle-proposals-menu" aria-haspopup="true" aria-expanded="false" aria-label="Proposals" data-corn-string-aria-label="proposals" title="Open a proposal: what a change would add, change and remove" data-corn="proposals-button">
|
|
106
106
|
<span aria-hidden="true">✎</span>
|
|
107
|
-
<span class="hx-only-wide">Proposals</span>
|
|
107
|
+
<span class="hx-only-wide" data-corn-string="proposals">Proposals</span>
|
|
108
108
|
<span class="hx-faint">▾</span>
|
|
109
109
|
</button>
|
|
110
110
|
<div id="proposal-menu" class="hx-menu hx-menu--proposals glass" hidden data-corn="proposals-menu"></div>
|
|
111
111
|
</div>
|
|
112
112
|
|
|
113
113
|
<!-- Issues and pull requests (explorer/forge-panel.js): shown only when the config names a forge -->
|
|
114
|
-
<button type="button" id="forge-btn" class="hx-btn hx-btn--forge" data-action="toggle-forge" aria-expanded="false" aria-controls="forge-panel" aria-label="Issues and pull requests" title="Issues, pull requests and deploys: a pull request lights the nodes it changes, a deploy the nodes it restarted" hidden data-corn="forge-button">
|
|
114
|
+
<button type="button" id="forge-btn" class="hx-btn hx-btn--forge" data-action="toggle-forge" aria-expanded="false" aria-controls="forge-panel" aria-label="Issues and pull requests" data-corn-string-aria-label="issuesAndPrs" title="Issues, pull requests and deploys: a pull request lights the nodes it changes, a deploy the nodes it restarted" hidden data-corn="forge-button">
|
|
115
115
|
<span aria-hidden="true">⎇</span>
|
|
116
|
-
<span class="hx-only-wide">Issues & PRs</span>
|
|
116
|
+
<span class="hx-only-wide" data-corn-string="issuesAndPrs">Issues & PRs</span>
|
|
117
117
|
<span id="forge-btn-lit" class="hx-forge-lit" hidden></span>
|
|
118
118
|
</button>
|
|
119
119
|
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
<button type="button" id="mobile-search-toggle" class="hx-btn hx-btn--icon hx-only-mobile" data-action="toggle-mobile-search" aria-label="Open Search" title="Search nodes" data-corn-kind="icon">⌕</button>
|
|
138
138
|
|
|
139
139
|
<div class="hx-search hx-only-desktop" role="search" data-corn="search">
|
|
140
|
-
<input type="text" id="node-search" class="hx-input" placeholder="Search..." aria-label="Search nodes" data-corn="search-input" />
|
|
140
|
+
<input type="text" id="node-search" class="hx-input" placeholder="Search..." data-corn-string-placeholder="searchPlaceholder" aria-label="Search nodes" data-corn="search-input" />
|
|
141
141
|
</div>
|
|
142
142
|
|
|
143
143
|
<button type="button" id="freeform-toggle-btn" class="hx-btn" data-action="toggle-freeform" title="Toggle between Orbit parent clustering and freeform node dragging" data-corn="layout-toggle">
|
|
@@ -201,11 +201,11 @@
|
|
|
201
201
|
<strong id="proposal-title" class="hx-proposal-name"></strong>
|
|
202
202
|
<button type="button" id="proposal-chip" class="hx-proposal-chip" data-action="toggle-proposal-changes" aria-expanded="false"></button>
|
|
203
203
|
<div class="hx-seg" role="group" aria-label="Compare">
|
|
204
|
-
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="before" aria-pressed="false">Before</button>
|
|
205
|
-
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="diff" aria-pressed="true">Diff</button>
|
|
206
|
-
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="after" aria-pressed="false">After</button>
|
|
204
|
+
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="before" aria-pressed="false" data-corn-string="before">Before</button>
|
|
205
|
+
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="diff" aria-pressed="true" data-corn-string="diff">Diff</button>
|
|
206
|
+
<button type="button" class="hx-seg-btn" data-action="proposal-view" data-view="after" aria-pressed="false" data-corn-string="after">After</button>
|
|
207
207
|
</div>
|
|
208
|
-
<button type="button" class="hx-btn hx-btn--quiet" data-action="close-proposal" title="Close the proposal and go back to the map" data-corn-kind="quiet">Close</button>
|
|
208
|
+
<button type="button" class="hx-btn hx-btn--quiet" data-action="close-proposal" title="Close the proposal and go back to the map" data-corn-kind="quiet" data-corn-string="closeProposal">Close</button>
|
|
209
209
|
</div>
|
|
210
210
|
<p id="proposal-summary" class="hx-proposal-summary" hidden></p>
|
|
211
211
|
<details id="proposal-errors" class="hx-proposal-errors" hidden>
|
|
@@ -228,12 +228,12 @@
|
|
|
228
228
|
<p id="forge-status" class="hx-forge-status hx-faint"></p>
|
|
229
229
|
<div class="hx-forge-controls">
|
|
230
230
|
<div class="hx-forge-tabs" role="group" aria-label="Show" data-corn="tabs">
|
|
231
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="true" data-corn="tab">Pull requests</button>
|
|
232
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab">Issues</button>
|
|
233
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="threads" aria-pressed="false" title="Ideas and spec conversations, with the nodes they mention" data-corn="tab">Threads</button>
|
|
234
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab">Deploys</button>
|
|
235
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Work grouped by issue and proposal, agent-made work marked" data-corn="tab">Agents</button>
|
|
236
|
-
<button type="button" class="hx-forge-tab" data-forge-kind="notes" aria-pressed="false" data-corn="tab">Release notes</button>
|
|
231
|
+
<button type="button" class="hx-forge-tab" data-forge-kind="pulls" aria-pressed="true" data-corn="tab" data-corn-string="tabPulls">Pull requests</button>
|
|
232
|
+
<button type="button" class="hx-forge-tab" data-forge-kind="issues" aria-pressed="false" data-corn="tab" data-corn-string="tabIssues">Issues</button>
|
|
233
|
+
<button type="button" class="hx-forge-tab" data-forge-kind="threads" aria-pressed="false" title="Ideas and spec conversations, with the nodes they mention" data-corn="tab" data-corn-string="tabThreads">Threads</button>
|
|
234
|
+
<button type="button" class="hx-forge-tab" data-forge-kind="deploys" aria-pressed="false" data-corn="tab" data-corn-string="tabDeploys">Deploys</button>
|
|
235
|
+
<button type="button" class="hx-forge-tab" data-forge-kind="work" aria-pressed="false" title="Work grouped by issue and proposal, agent-made work marked" data-corn="tab" data-corn-string="tabAgents">Agents</button>
|
|
236
|
+
<button type="button" class="hx-forge-tab" data-forge-kind="notes" aria-pressed="false" data-corn="tab" data-corn-string="tabNotes">Release notes</button>
|
|
237
237
|
</div>
|
|
238
238
|
<div id="forge-work-filters" class="hx-forge-work-filters" hidden>
|
|
239
239
|
<label class="hx-forge-toggle"><input type="checkbox" id="forge-work-agents" /> Agent-made only</label>
|
|
@@ -249,13 +249,13 @@
|
|
|
249
249
|
<p id="forge-notice" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
250
250
|
<p id="forge-act-note" class="hx-forge-notice" hidden data-corn="notice"></p>
|
|
251
251
|
<!-- New idea (forge-panel.js): opens an issue with the threads label as you, on the forge; the thread itself lives there -->
|
|
252
|
-
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" hidden>
|
|
252
|
+
<section id="forge-idea" class="hx-forge-notes" aria-label="New idea" data-corn-string-aria-label="newIdea" hidden>
|
|
253
253
|
<div class="hx-forge-actions">
|
|
254
|
-
<button type="button" id="idea-open" class="hx-btn hx-btn--approve" data-action="idea-open" aria-expanded="false" aria-controls="idea-form" data-corn-kind="approve">New idea …</button>
|
|
254
|
+
<button type="button" id="idea-open" class="hx-btn hx-btn--approve" data-action="idea-open" aria-expanded="false" aria-controls="idea-form" data-corn-kind="approve"><span data-corn-string="newIdea">New idea</span> …</button>
|
|
255
255
|
</div>
|
|
256
256
|
<p id="idea-message" class="hx-forge-msg" role="status" hidden data-corn="message"></p>
|
|
257
257
|
<div id="idea-form" class="hx-forge-confirm" role="group" aria-labelledby="idea-form-title" hidden>
|
|
258
|
-
<h3 id="idea-form-title" class="hx-forge-confirm-title">New idea</h3>
|
|
258
|
+
<h3 id="idea-form-title" class="hx-forge-confirm-title" data-corn-string="newIdea">New idea</h3>
|
|
259
259
|
<p id="idea-words"></p>
|
|
260
260
|
<label class="hx-forge-field" data-corn="field">Title<input type="text" id="idea-title" class="hx-forge-input" maxlength="256" autocomplete="off" /></label>
|
|
261
261
|
<label class="hx-forge-field" data-corn="field">What is the idea?<textarea id="idea-body" class="hx-forge-preview hx-thread-compose" rows="6" maxlength="20000" spellcheck="true"></textarea></label>
|
|
@@ -315,19 +315,19 @@
|
|
|
315
315
|
<p id="drawer-description" class="hx-faint hx-lead"></p>
|
|
316
316
|
|
|
317
317
|
<div class="hx-block">
|
|
318
|
-
<h3 class="hx-block-title">Properties & Attributes</h3>
|
|
318
|
+
<h3 class="hx-block-title" data-corn-string="propsTitle">Properties & Attributes</h3>
|
|
319
319
|
<div id="drawer-props-list" class="hx-props"></div>
|
|
320
320
|
</div>
|
|
321
321
|
|
|
322
322
|
<div class="hx-block">
|
|
323
|
-
<h3 class="hx-block-title">Details</h3>
|
|
323
|
+
<h3 class="hx-block-title" data-corn-string="detailsTitle">Details</h3>
|
|
324
324
|
<div id="drawer-meta-list" class="hx-meta"></div>
|
|
325
325
|
</div>
|
|
326
326
|
</div>
|
|
327
327
|
|
|
328
328
|
<div class="hx-drawer-foot">
|
|
329
329
|
<a id="drawer-open-btn" class="hx-open" href="#" target="_blank" rel="noreferrer">Open ↗</a>
|
|
330
|
-
<button type="button" class="hx-btn hx-btn--copy" data-action="copy-spec">Copy Spec</button>
|
|
330
|
+
<button type="button" class="hx-btn hx-btn--copy" data-action="copy-spec" data-corn-string="copySpec">Copy Spec</button>
|
|
331
331
|
</div>
|
|
332
332
|
</aside>
|
|
333
333
|
</div>
|
|
@@ -345,12 +345,12 @@
|
|
|
345
345
|
</div>
|
|
346
346
|
|
|
347
347
|
<!-- Loading and error states: a failed load never leaves a blank canvas -->
|
|
348
|
-
<div id="loading-state" class="hx-state" role="status" data-corn="loading">Loading topology.json …</div>
|
|
348
|
+
<div id="loading-state" class="hx-state" role="status" data-corn="loading" data-corn-string="loading">Loading topology.json …</div>
|
|
349
349
|
<div id="error-state" class="hx-state hx-state--error glass" role="alert" hidden data-corn="error">
|
|
350
|
-
<strong>The map could not be loaded</strong>
|
|
350
|
+
<strong data-corn-string="errorTitle">The map could not be loaded</strong>
|
|
351
351
|
<p id="error-message"></p>
|
|
352
352
|
<p class="hx-faint">The explorer reads /topology.json from the cornfield server (cornfield serve). Run cornfield sync if the repo has no map yet, check that the server is up, then retry.</p>
|
|
353
|
-
<button type="button" class="hx-btn hx-btn--active" data-action="retry" data-corn-kind="primary">Retry</button>
|
|
353
|
+
<button type="button" class="hx-btn hx-btn--active" data-action="retry" data-corn-kind="primary" data-corn-string="retry">Retry</button>
|
|
354
354
|
</div>
|
|
355
355
|
|
|
356
356
|
<div id="drawer-backdrop" class="hx-backdrop" data-action="close-drawer" hidden data-corn="backdrop"></div>
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
<div id="forge-confirm-body"></div>
|
|
365
365
|
<div class="hx-confirm-actions">
|
|
366
366
|
<button type="button" class="hx-btn" data-action="forge-confirm-cancel">Cancel</button>
|
|
367
|
-
<button type="button" class="hx-btn hx-btn--approve" data-action="forge-confirm-go" data-corn-kind="approve">Land it</button>
|
|
367
|
+
<button type="button" class="hx-btn hx-btn--approve" data-action="forge-confirm-go" data-corn-kind="approve" data-corn-string="landIt">Land it</button>
|
|
368
368
|
</div>
|
|
369
369
|
</div>
|
|
370
370
|
</div>
|
|
@@ -372,7 +372,7 @@
|
|
|
372
372
|
<!-- Start an agent (forge-panel.js): kind, profile, a brief, and a confirm step; a modal dialog over a scrim, the focus stays in it -->
|
|
373
373
|
<div id="agent-start" class="hx-confirm-scrim" hidden data-corn="dialog-scrim">
|
|
374
374
|
<div class="hx-confirm glass" role="dialog" aria-modal="true" aria-labelledby="agent-start-title" aria-describedby="agent-start-words" data-corn="agent-dialog">
|
|
375
|
-
<h2 id="agent-start-title" class="hx-confirm-title">Start an agent</h2>
|
|
375
|
+
<h2 id="agent-start-title" class="hx-confirm-title" data-corn-string="startAgent">Start an agent</h2>
|
|
376
376
|
<p id="agent-start-about" class="hx-forge-meta"></p>
|
|
377
377
|
<p id="agent-start-runner" class="hx-forge-meta" hidden></p>
|
|
378
378
|
<p id="agent-retry-note" class="hx-forge-meta" hidden></p>
|
|
@@ -391,7 +391,7 @@
|
|
|
391
391
|
<p id="agent-start-msg" class="hx-forge-msg hx-forge-msg--bad" role="alert" hidden data-corn="message" data-corn-state="failure"></p>
|
|
392
392
|
<div class="hx-confirm-actions">
|
|
393
393
|
<button type="button" class="hx-btn" data-action="agent-start-cancel">Cancel</button>
|
|
394
|
-
<button type="submit" class="hx-btn hx-btn--approve" id="agent-start-go" data-corn-kind="approve">Ask the runner</button>
|
|
394
|
+
<button type="submit" class="hx-btn hx-btn--approve" id="agent-start-go" data-corn-kind="approve" data-corn-string="askRunner">Ask the runner</button>
|
|
395
395
|
</div>
|
|
396
396
|
</form>
|
|
397
397
|
</div>
|
package/explorer/labels.js
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
38
|
import { EDGE_LABEL_SIZE, FONT_EDGE, FONT_NODE, labelAt, looksFor } from './scene.js';
|
|
39
|
+
import { getMapStyle, styledScene } from './map-style.js';
|
|
39
40
|
|
|
40
41
|
/** At most this many node labels at a time (lane text and selection edge labels are extra) */
|
|
41
42
|
export const MAX_LABELS = 400;
|
|
@@ -68,7 +69,7 @@ const TIER_REST = 3;
|
|
|
68
69
|
export function chooseLabels(scene, camera, viewport, opts = {}) {
|
|
69
70
|
const { max = MAX_LABELS, margin = CULL_MARGIN, measure = null } = opts;
|
|
70
71
|
const out = [];
|
|
71
|
-
const outline = looksFor(scene.theme).labelOutline; // the ground's own colour, under the text
|
|
72
|
+
const outline = scene.labelOutline || looksFor(scene.theme).labelOutline; // the ground's own colour (or the theme's --corn-map-label-halo), under the text
|
|
72
73
|
|
|
73
74
|
// Always there: the data-flow lanes' titles, notes and arrows ...
|
|
74
75
|
for (const lane of scene.decor.lanes) {
|
|
@@ -168,13 +169,16 @@ function coverWithNodes(ctx, nodes) {
|
|
|
168
169
|
/**
|
|
169
170
|
* A transparent 2D canvas that draws the chosen labels over the map
|
|
170
171
|
* @param {HTMLCanvasElement} canvas
|
|
172
|
+
* @param {{mapStyle?: () => import('./map-style.js').MapStyle}} [opts] `mapStyle`: where the theme's map tokens come from (default: the page's, map-style.js `getMapStyle`);
|
|
173
|
+
* a node's label colour is the theme's `--corn-map-label`, and the outline under every label its `--corn-map-label-halo`, when it sets them
|
|
171
174
|
* @returns {{draw: (scene: import('./scene.js').Scene, camera: import('./scene.js').Camera) => boolean, resize: (width: number, height: number, dpr: number) => void, destroy: () => void}}
|
|
172
175
|
* `draw` returns whether it painted: false when the camera, the scene and the size were unchanged
|
|
173
176
|
*/
|
|
174
|
-
export function createLabelLayer(canvas) {
|
|
177
|
+
export function createLabelLayer(canvas, opts = {}) {
|
|
178
|
+
const styleOf = opts.mapStyle || getMapStyle;
|
|
175
179
|
const ctx = canvas.getContext('2d');
|
|
176
180
|
let width = 0, height = 0, dpr = 1;
|
|
177
|
-
let lastScene = null, lastVersion, lastX, lastY, lastZoom;
|
|
181
|
+
let lastScene = null, lastVersion, lastX, lastY, lastZoom, lastStyle;
|
|
178
182
|
let dirty = true;
|
|
179
183
|
let destroyed = false;
|
|
180
184
|
|
|
@@ -202,11 +206,14 @@ export function createLabelLayer(canvas) {
|
|
|
202
206
|
dirty = true;
|
|
203
207
|
},
|
|
204
208
|
|
|
205
|
-
draw(
|
|
209
|
+
draw(drawn, camera) {
|
|
206
210
|
if (destroyed) return false;
|
|
207
|
-
|
|
208
|
-
|
|
211
|
+
const style = styleOf();
|
|
212
|
+
const styleKey = style.plain ? 0 : style.version;
|
|
213
|
+
if (!dirty && drawn === lastScene && drawn.version === lastVersion && camera.x === lastX && camera.y === lastY && camera.zoom === lastZoom && styleKey === lastStyle) return false;
|
|
214
|
+
lastScene = drawn; lastVersion = drawn.version; lastX = camera.x; lastY = camera.y; lastZoom = camera.zoom; lastStyle = styleKey;
|
|
209
215
|
dirty = false;
|
|
216
|
+
const scene = styledScene(drawn, style); // the label colours of the theme (map-style.js)
|
|
210
217
|
|
|
211
218
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
212
219
|
ctx.clearRect(0, 0, width, height);
|
package/explorer/main.js
CHANGED
|
@@ -47,6 +47,7 @@ import { initForgePanel } from './forge-panel.js';
|
|
|
47
47
|
import { initReviewTokens } from './review-tokens.js';
|
|
48
48
|
import { loadClientConfig, loadSources, applyBranding } from './plugins.js';
|
|
49
49
|
import { cycleTheme, initTheme } from './theme.js';
|
|
50
|
+
import { applyMapTheme, onMapStyleChange, watchMapStyle } from './map-style.js';
|
|
50
51
|
|
|
51
52
|
const $ = (id) => document.getElementById(id);
|
|
52
53
|
|
|
@@ -186,6 +187,8 @@ async function runPageBench(frames, zoomFactor, sync) {
|
|
|
186
187
|
// Start
|
|
187
188
|
// ---------------------------------------------------------------------------
|
|
188
189
|
initTheme(); // light or dark, before the first scene is built (theme.js)
|
|
190
|
+
watchMapStyle(document); // the map reads --corn-map-* from the theme, and again when it changes (map-style.js)
|
|
191
|
+
onMapStyleChange(() => render());
|
|
189
192
|
state.canvas = $('graph-canvas');
|
|
190
193
|
state.labelCanvas = $('label-canvas');
|
|
191
194
|
// A 2d context that only measures text (layout.js labelWidth): the map canvas may be WebGL, and a
|
|
@@ -204,7 +207,7 @@ $('mobile-node-search').addEventListener('input', (e) => handleSearch(e.target.v
|
|
|
204
207
|
resize();
|
|
205
208
|
syncViewUi();
|
|
206
209
|
// /?proposal=<slug> opens a proposal over the map, /?view=dataflow the data-flow preset: both have a link
|
|
207
|
-
const configReady = loadClientConfig().then((config) => { applyBranding(document, config); return config; });
|
|
210
|
+
const configReady = loadClientConfig().then((config) => { applyBranding(document, config); applyMapTheme(document, config.theme); syncViewUi(); return config; }); // the brand, then the theme's icons for the map; the hint again, in the repo's words
|
|
208
211
|
loadTopology().then(async (ok) => {
|
|
209
212
|
if (!ok) return;
|
|
210
213
|
// The sources the repo's cornfield.config.js names (plugins.js): a live layer, a house, devices, a checker; each optional
|