@popcorn245/cornfield 0.35.0 → 0.36.1

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.
@@ -13,6 +13,9 @@
13
13
  * --corn-map-selected|match the halo of the selected node, and of a search hit
14
14
  * --corn-map-lit the lines of the focus: the links the selection (or a walk's step) lights
15
15
  * --corn-map-collision the collision mark of two runs on one node (a DOM mark: explorer.css reads it)
16
+ * --corn-map-font the font list of every label on the map (a list of families, `auto` for the map's own)
17
+ * --corn-map-edge-width the width of an ordinary line, in map px (`auto` keeps each line's own; the focus's and the marks' keep their proportion)
18
+ * --corn-map-glow the soft glow round nodes, lines and packets: a factor (`0` none, `1` as drawn, `auto` as drawn)
16
19
  *
17
20
  * `auto` (the default of every one of them but the width and the collision) means "keep what the map draws without a theme": the
18
21
  * node's own colour from the topology, deepened for the light ground by theme-model.js, and every other colour as scene.js has
@@ -46,6 +49,17 @@ export const STROKE_WIDTH_TOKEN = '--corn-map-stroke-width';
46
49
  export const LABEL_TOKEN = '--corn-map-label';
47
50
  export const LABEL_HALO_TOKEN = '--corn-map-label-halo';
48
51
  export const COLLISION_TOKEN = '--corn-map-collision';
52
+ export const FONT_TOKEN = '--corn-map-font';
53
+ export const EDGE_WIDTH_TOKEN = '--corn-map-edge-width';
54
+ export const GLOW_TOKEN = '--corn-map-glow';
55
+ /** The width an ordinary line has with no theme (scene.js `flowEdge`): the `--corn-map-edge-width` scales every line by its ratio to this */
56
+ export const BASE_EDGE_WIDTH = 1.6;
57
+ /** The most a font list may hold: the families, and the characters */
58
+ export const MAX_FONT_FAMILIES = 8;
59
+ export const MAX_FONT_CHARS = 200;
60
+ /** The widest a line may be set, and the largest glow factor: a typo cannot draw a map of paint */
61
+ export const MAX_EDGE_WIDTH = 12;
62
+ export const MAX_GLOW = 4;
49
63
  /** The width of an outline when the token is not a length (px, world units) */
50
64
  export const DEFAULT_STROKE_WIDTH = 1.5;
51
65
  /** An icon is drawn this many radii across (a square, so it fits inside the circle) */
@@ -70,7 +84,7 @@ export const MAP_COLOR_TOKENS = Object.freeze([
70
84
  ...MAP_STATES.map(stateToken),
71
85
  ]);
72
86
  /** Every map token */
73
- export const mapTokenNames = () => [...MAP_COLOR_TOKENS, STROKE_WIDTH_TOKEN, COLLISION_TOKEN];
87
+ export const mapTokenNames = () => [...MAP_COLOR_TOKENS, STROKE_WIDTH_TOKEN, COLLISION_TOKEN, FONT_TOKEN, EDGE_WIDTH_TOKEN, GLOW_TOKEN];
74
88
 
75
89
  // ---------------------------------------------------------------------------
76
90
  // Reading a token
@@ -153,10 +167,56 @@ export function withAlphaOf(token, original) {
153
167
  return rgbaText(r, g, b, a * oa);
154
168
  }
155
169
 
170
+ const GENERIC_FAMILY = /^(?:serif|sans-serif|monospace|cursive|fantasy|system-ui|ui-serif|ui-sans-serif|ui-monospace|ui-rounded|emoji|math|fangsong)$/i;
171
+ const SYSTEM_FONT_KEYWORD = /^(?:-apple-system|BlinkMacSystemFont)$/;
172
+
173
+ /**
174
+ * A font list the canvas may be given, or null (`auto`, empty, or anything that is not a plain list of families). Each family is a name in
175
+ * quotes, or bare words (`Nunito`, `ui-rounded`, `sans-serif`); nothing that can carry a URL or script (no parentheses, slashes, colons,
176
+ * semicolons, braces, angle brackets, `@`, backslashes, `url`, `var`, `expression`) and no more than MAX_FONT_FAMILIES of them.
177
+ * Returned with each name quoted, so a name with a space is one family.
178
+ * @param {unknown} value
179
+ * @returns {string | null}
180
+ */
181
+ export function cssFontList(value) {
182
+ const s = typeof value === 'string' ? value.trim() : '';
183
+ if (!s || s.length > MAX_FONT_CHARS || s.toLowerCase() === 'auto') return null;
184
+ if (/[();:{}<>@\\/\u0000-\u001f\u007f]|\burl\b|\bvar\b|\bexpression\b|\bimport\b/i.test(s)) return null;
185
+ const parts = s.split(',').map((p) => p.trim());
186
+ if (parts.length > MAX_FONT_FAMILIES) return null;
187
+ const out = [];
188
+ for (const part of parts) {
189
+ const quoted = /^"([A-Za-z0-9 ._+-]{1,60})"$|^'([A-Za-z0-9 ._+-]{1,60})'$/.exec(part);
190
+ // A bare name may start with one hyphen (`-apple-system`, in cornfield's own --corn-font), never two (a custom property's name)
191
+ const name = quoted ? (quoted[1] ?? quoted[2]).trim() : /^-?[A-Za-z][A-Za-z0-9 _-]{0,59}$/.test(part) ? part.replace(/\s+/g, ' ') : null;
192
+ if (!name) return null;
193
+ // Generic families and the two system-font keywords stay bare (quoted, they would name a font called that); every other name is quoted
194
+ out.push(GENERIC_FAMILY.test(name) ? name.toLowerCase() : SYSTEM_FONT_KEYWORD.test(name) ? name : `"${name}"`);
195
+ }
196
+ return out.join(', ');
197
+ }
198
+
199
+ /** A length in px (`2px`, `2`) over 0 and at most max, or null for `auto` and anything else (a canvas ignores a line width of 0) */
200
+ function pxOf(value, max) {
201
+ const m = /^\s*(\d*\.?\d+)(?:px)?\s*$/i.exec(String(value ?? ''));
202
+ const n = m ? parseFloat(m[1]) : NaN;
203
+ return Number.isFinite(n) && n > 0 && n <= max ? n : null;
204
+ }
205
+
206
+ /** The glow factor: a number (`0` for none, `1` as drawn, up to MAX_GLOW; `0px` reads as 0), or null for `auto` and anything else */
207
+ function factorOf(value) {
208
+ const m = /^\s*(\d*\.?\d+)(px)?\s*$/i.exec(String(value ?? ''));
209
+ if (!m) return null;
210
+ const n = parseFloat(m[1]);
211
+ if (m[2] && n !== 0) return null; // a length is not a factor, only zero is the same in both
212
+ return Number.isFinite(n) && n >= 0 && n <= MAX_GLOW ? n : null;
213
+ }
214
+
156
215
  /**
157
216
  * The tokens as the page computes them.
158
217
  * @param {(name: string) => string} read the value of a custom property
159
- * @returns {{values: Record<string, string>, strokeWidth: number}} `values` holds only the tokens that are a colour (not `auto`)
218
+ * @returns {{values: Record<string, string>, strokeWidth: number, font: string | null, edgeWidth: number | null, glow: number | null}}
219
+ * `values` holds only the tokens that are a colour (not `auto`); `font`, `edgeWidth` and `glow` are null at `auto` or when the value is not one
160
220
  */
161
221
  export function readMapTokens(read) {
162
222
  const values = {};
@@ -165,7 +225,13 @@ export function readMapTokens(read) {
165
225
  if (c) values[name] = c;
166
226
  }
167
227
  const w = parseFloat(String(read(STROKE_WIDTH_TOKEN) ?? ''));
168
- return { values, strokeWidth: Number.isFinite(w) && w >= 0 ? w : DEFAULT_STROKE_WIDTH };
228
+ return {
229
+ values,
230
+ strokeWidth: Number.isFinite(w) && w >= 0 ? w : DEFAULT_STROKE_WIDTH,
231
+ font: cssFontList(read(FONT_TOKEN)),
232
+ edgeWidth: pxOf(read(EDGE_WIDTH_TOKEN), MAX_EDGE_WIDTH),
233
+ glow: factorOf(read(GLOW_TOKEN)),
234
+ };
169
235
  }
170
236
 
171
237
  /** A reader of the page's computed custom properties, or null where there is no page */
@@ -230,12 +296,16 @@ export function createIconStore(urls, { load = loadImage, onChange = () => {}, w
230
296
  * @property {number} version changes whenever anything below does: a renderer draws again when it differs from the one it drew
231
297
  * @property {Record<string, string>} values the tokens that are a colour, by name (those at `auto` are absent)
232
298
  * @property {number} strokeWidth px, world units
299
+ * @property {string | null} font the label font list (`--corn-map-font`), null at `auto`
300
+ * @property {number | null} edgeWidth an ordinary line's width in px (`--corn-map-edge-width`), null at `auto`
301
+ * @property {number | null} glow the glow factor (`--corn-map-glow`), null at `auto`
233
302
  * @property {ReturnType<typeof createIconStore> | null} icons
234
303
  * @property {boolean} pixelated sample icons without smoothing
235
304
  * @property {boolean} plain nothing to apply: no colour set, no icon loaded (the scene is drawn as it is)
236
305
  */
237
306
 
238
- let tokens = { values: {}, strokeWidth: DEFAULT_STROKE_WIDTH };
307
+ const NO_TOKENS = { values: {}, strokeWidth: DEFAULT_STROKE_WIDTH, font: null, edgeWidth: null, glow: null };
308
+ let tokens = NO_TOKENS;
239
309
  let icons = null;
240
310
  let pixelated = false;
241
311
  let version = 0;
@@ -243,8 +313,8 @@ let current = compose();
243
313
  const listeners = new Set();
244
314
 
245
315
  function compose() {
246
- const plain = !Object.keys(tokens.values).length && !(icons && icons.anyReady());
247
- return Object.freeze({ version, values: tokens.values, strokeWidth: tokens.strokeWidth, icons, pixelated, plain });
316
+ const plain = !Object.keys(tokens.values).length && !(icons && icons.anyReady()) && tokens.font === null && tokens.edgeWidth === null && tokens.glow === null;
317
+ return Object.freeze({ version, values: tokens.values, strokeWidth: tokens.strokeWidth, font: tokens.font, edgeWidth: tokens.edgeWidth, glow: tokens.glow, icons, pixelated, plain });
248
318
  }
249
319
 
250
320
  function changed() {
@@ -269,12 +339,14 @@ export function onMapStyleChange(fn) {
269
339
  export function refreshMapStyle(read = pageReader()) {
270
340
  if (!read) return false;
271
341
  const next = readMapTokens(read);
272
- const same = next.strokeWidth === tokens.strokeWidth
342
+ const same = next.strokeWidth === tokens.strokeWidth && next.font === tokens.font && next.edgeWidth === tokens.edgeWidth && next.glow === tokens.glow
273
343
  && Object.keys(next.values).length === Object.keys(tokens.values).length
274
344
  && Object.entries(next.values).every(([k, v]) => tokens.values[k] === v);
275
345
  if (same) return false;
276
346
  tokens = next;
277
347
  changed();
348
+ // A web font the labels name is fetched when something asks for it, and a canvas does not wait for one: ask now, and draw again when it is in
349
+ try { if (next.font && typeof document !== 'undefined' && document.fonts && document.fonts.load) document.fonts.load(`12px ${next.font}`).catch(() => {}); } catch { /* no font loading here */ }
278
350
  return true;
279
351
  }
280
352
 
@@ -304,7 +376,7 @@ export function applyMapTheme(doc, theme, opts = {}) {
304
376
 
305
377
  /** Back to nothing set (for tests) */
306
378
  export function resetMapStyle() {
307
- tokens = { values: {}, strokeWidth: DEFAULT_STROKE_WIDTH };
379
+ tokens = NO_TOKENS;
308
380
  icons = null;
309
381
  pixelated = false;
310
382
  changed();
@@ -332,6 +404,12 @@ export function watchMapStyle(doc) {
332
404
  if (media.addEventListener) { media.addEventListener('change', refresh); stops.push(() => media.removeEventListener('change', refresh)); }
333
405
  else if (media.addListener) { media.addListener(refresh); stops.push(() => media.removeListener(refresh)); }
334
406
  }
407
+ const fonts = doc.fonts;
408
+ if (fonts && fonts.addEventListener) {
409
+ const again = () => { if (tokens.font) changed(); }; // the label font arrived: the canvas draws again with it
410
+ fonts.addEventListener('loadingdone', again);
411
+ stops.push(() => fonts.removeEventListener('loadingdone', again));
412
+ }
335
413
  refresh();
336
414
  return () => stops.forEach((fn) => fn());
337
415
  }
@@ -342,20 +420,30 @@ export function watchMapStyle(doc) {
342
420
 
343
421
  const firstOf = (values, names) => { for (const n of names) if (values[n]) return values[n]; return null; };
344
422
 
345
- function styleEdge(e, values, painted) {
423
+ /** A line's shape in the theme: its width scaled to `--corn-map-edge-width`, its glow and its packet's by `--corn-map-glow` (nothing at `auto`) */
424
+ function shapeEdge(e, style) {
425
+ const scale = style.edgeWidth == null ? 1 : style.edgeWidth / BASE_EDGE_WIDTH;
426
+ const glow = style.glow == null ? 1 : style.glow;
427
+ if (scale === 1 && glow === 1) return e;
428
+ const out = { ...e, width: e.width * scale, glow: e.glow * glow };
429
+ if (e.packet) out.packet = { ...e.packet, glow: e.packet.glow * glow };
430
+ return out;
431
+ }
432
+
433
+ function styleEdge(e, style, painted) {
434
+ const { values } = style;
346
435
  if (e.mark && e.mark !== 'none') {
347
436
  const c = values[stateToken(e.mark)];
348
- if (!c) return e;
349
- return { ...e, color: c, glowColor: e.glowColor ? c : e.glowColor };
437
+ return shapeEdge(c ? { ...e, color: c, glowColor: e.glowColor ? c : e.glowColor } : e, style);
350
438
  }
351
- if (painted.has(e.key)) return e;
439
+ if (painted.has(e.key)) return shapeEdge(e, style);
352
440
  const lit = !e.curve && e.glow > 0 && !e.arrow; // a straight link the focus lights
353
441
  const c = (lit && values[stateToken('lit')]) || values[edgeToken(e.kind)];
354
- if (!c) return e;
442
+ if (!c) return shapeEdge(e, style);
355
443
  const out = { ...e, color: withAlphaOf(c, e.color) };
356
444
  if (e.glowColor) out.glowColor = withAlphaOf(c, e.glowColor);
357
445
  if (e.packet) out.packet = { ...e.packet, glowColor: withAlphaOf(c, e.packet.glowColor) };
358
- return out;
446
+ return shapeEdge(out, style);
359
447
  }
360
448
 
361
449
  function compute(scene, style) {
@@ -366,15 +454,18 @@ function compute(scene, style) {
366
454
  const nodes = scene.nodes.map((n) => {
367
455
  const fill = !painted.nodes.has(n.id) && firstOf(values, [nodeToken(n.type), groupToken(n.group || n.type)]);
368
456
  const icon = style.icons && style.icons.get(n.type) ? n.type : null;
369
- if (!fill && !label && !stroke && !icon) return n;
457
+ const glows = style.glow != null && style.glow !== 1 && n.glow > 0;
458
+ if (!fill && !label && !stroke && !icon && !glows) return n;
370
459
  const out = { ...n };
460
+ if (glows) out.glow = n.glow * style.glow;
371
461
  if (fill) out.color = fill;
372
462
  if (label) out.labelColor = withAlphaOf(label, n.labelColor);
373
463
  if (stroke && style.strokeWidth > 0) out.stroke = { color: stroke, width: style.strokeWidth };
374
464
  if (icon) out.icon = icon;
375
465
  return out;
376
466
  });
377
- const out = { ...scene, nodes, edges: scene.edges.map((e) => styleEdge(e, values, painted.edges)) };
467
+ const out = { ...scene, nodes, edges: scene.edges.map((e) => styleEdge(e, style, painted.edges)) };
468
+ if (style.font) out.labelFont = style.font; // every label's font list (labels.js reads `scene.labelFont`)
378
469
  const halo = values[LABEL_HALO_TOKEN];
379
470
  if (halo) { // the outline under the labels, at the widths it has (labels.js reads `scene.labelOutline` before the ground's own)
380
471
  const { node, edge } = looksFor(scene.theme).labelOutline;
@@ -19,6 +19,7 @@ import { cloudPanelHtml } from './cloud-model.js';
19
19
  import { t } from './strings.js';
20
20
  import { fileUrl } from './file-url.js';
21
21
  import { capped, toggleCapped } from './capped.js';
22
+ import { dismissHint } from './hint.js';
22
23
  import { canStartAgent, openProposalStart } from './forge-panel.js';
23
24
  import { sayResult, clearResult, showResultIn, RESULT_MS } from './feedback.js';
24
25
 
@@ -226,6 +227,7 @@ export async function selectNode(node) {
226
227
  if (!node) return;
227
228
  const token = ++selectToken;
228
229
  clearScenario();
230
+ dismissHint(); // a node has been picked: the hint's job is done for this session
229
231
  state.selectedNode = node;
230
232
  state.selectedEdge = null;
231
233
  touchScene();
@@ -23,7 +23,17 @@ export const NO_SOURCE = Object.freeze({
23
23
  name: 'no live source',
24
24
  async load() {
25
25
  const err = new Error('no live source is configured');
26
- Object.assign(err, { reason: 'unavailable', hint: 'no live source is set in cornfield.config.js (sources)' });
26
+ Object.assign(err, { reason: 'unavailable', notConfigured: true, hint: 'no live source is set in cornfield.config.js (sources)' });
27
+ throw err;
28
+ },
29
+ });
30
+
31
+ /** What the live layer shows when the repo names a live, house or devices source and none of them loaded: an error, not "none set" */
32
+ export const failedSource = (slots) => Object.freeze({
33
+ name: 'live source that did not load',
34
+ async load() {
35
+ const err = new Error('the live source did not load');
36
+ Object.assign(err, { reason: 'unavailable', hint: `the ${slots.join(' and ')} source in cornfield.config.js did not load (the browser console says why)` });
27
37
  throw err;
28
38
  },
29
39
  });
@@ -188,12 +198,14 @@ export function combineSources(sources) {
188
198
  * Loads the sources a config names.
189
199
  * @param {{ sources?: Record<string, { module: string, options?: object } | null> }} config
190
200
  * @param {(url: string) => Promise<any>} [importer]
191
- * @returns {Promise<{ liveSource: object, floorRenderer: object|null, checker: object|null }>}
201
+ * @returns {Promise<{ houseSource: boolean, liveSource: object, floorRenderer: object|null, checker: object|null }>}
192
202
  */
193
203
  export async function loadSources(config, importer = (url) => import(url)) {
194
204
  const loaded = {};
205
+ const named = []; // the live, house and devices slots the config names: a house can come from any of them
195
206
  for (const [slot, s] of Object.entries((config && config.sources) || {})) {
196
207
  if (!s || typeof s.module !== 'string' || !s.module.startsWith('/')) continue;
208
+ if (['live', 'house', 'devices'].includes(slot)) named.push(slot);
197
209
  try {
198
210
  const mod = await importer(s.module);
199
211
  loaded[slot] = typeof mod.create === 'function' ? (await mod.create(s.options || {})) || {} : mod;
@@ -204,7 +216,10 @@ export async function loadSources(config, importer = (url) => import(url)) {
204
216
  const pick = (key, order) => order.map((slot) => loaded[slot] && loaded[slot][key]).find(Boolean) || null;
205
217
  const lives = ['live', 'house', 'devices'].map((slot) => loaded[slot] && loaded[slot].liveSource).filter(Boolean);
206
218
  return {
207
- liveSource: lives.length ? combineSources(lives) : NO_SOURCE,
219
+ // The config names a source that can answer for a house: the House view is offered (house-model.js `houseOffered`), even when the
220
+ // source did not load, so its failure shows as one (the live chip's error) rather than as a House button gone missing
221
+ houseSource: named.length > 0,
222
+ liveSource: lives.length ? combineSources(lives) : named.length ? failedSource(named) : NO_SOURCE,
208
223
  floorRenderer: pick('floorRenderer', ['house', 'live', 'devices']),
209
224
  checker: pick('checker', ['checker', 'live', 'house', 'devices']),
210
225
  };
@@ -129,6 +129,14 @@ export function loadingRowsHtml(n = 3) {
129
129
  return Array.from({ length: n }, () => '<li class="hx-forge-skeleton" data-corn="skeleton" aria-hidden="true"><span></span><span></span></li>').join('');
130
130
  }
131
131
 
132
+ /**
133
+ * Placeholder lines for the runner line and the totals above the runs while they load (issue #192): each is one `hx-forge-meta` line high, as the
134
+ * line it stands for, so the list under them does not move when the data arrives.
135
+ */
136
+ export function loadingLinesHtml(n = 1) {
137
+ return Array.from({ length: n }, () => '<p class="hx-forge-meta hx-forge-skeleton-line" data-corn="skeleton" aria-hidden="true"><span></span></p>').join('');
138
+ }
139
+
132
140
  /** One run */
133
141
  export function runHtml(ctx, run, all) {
134
142
  const lit = ctx.selected === run.runId;
@@ -228,7 +228,7 @@ function showBar(speed) {
228
228
  <select class="hx-player-speed" data-action="scenario-speed" aria-label="Time for each step" title="Time for each step">${SPEED_CHOICES.map((c) => `<option value="${c.value}">${c.label}</option>`).join('')}</select>
229
229
  <button type="button" class="hx-close" data-action="scenario-close" aria-label="Close the scenario" data-corn-kind="icon">✕</button>
230
230
  </div>
231
- <p class="hx-player-text" aria-live="polite"><span class="hx-player-count"></span> · <span class="hx-player-step"></span></p>
231
+ <p class="hx-player-text" aria-live="polite"><span class="hx-player-count" data-corn="count"></span> · <span class="hx-player-step"></span></p>
232
232
  <div class="hx-player-controls">
233
233
  <button type="button" class="hx-btn" data-action="scenario-prev" data-peek-ok>◀ Previous</button>
234
234
  <button type="button" class="hx-btn hx-btn--active" data-action="scenario-toggle" data-peek-ok data-corn-kind="primary"></button>
@@ -0,0 +1,73 @@
1
+ /*
2
+ * The sign-in, "ask a maintainer" and 401 pages (server/auth.js), the ones a visitor sees before the explorer. Plain CSS; every colour,
3
+ * font, size, radius, border width, shadow and space is a --corn-* token from explorer/tokens.css (loaded before this file), and the
4
+ * repo's theme stylesheet is linked after it, so a brand reaches these pages as it reaches the map. Hooks: [data-corn="auth-page"] (the
5
+ * body), "auth-card", "auth-brand", "auth-reason"; the buttons carry data-corn-kind. Not loaded by the explorer. The server sends these
6
+ * files without a session (server/server.js, docs/sign-in.md), so keep nothing private in them.
7
+ */
8
+
9
+ *, *::before, *::after { box-sizing: border-box; }
10
+ [hidden] { display: none !important; }
11
+
12
+ body {
13
+ margin: 0;
14
+ min-height: 100dvh;
15
+ display: grid;
16
+ place-items: center;
17
+ padding: var(--corn-space-5);
18
+ background-color: var(--corn-ground);
19
+ background-image: var(--corn-ground-image);
20
+ background-attachment: fixed;
21
+ color: var(--corn-text-2);
22
+ font-family: var(--corn-font);
23
+ font-size: var(--corn-text-base);
24
+ line-height: 1.5;
25
+ -webkit-font-smoothing: antialiased;
26
+ }
27
+
28
+ [data-corn="auth-card"] {
29
+ width: 100%;
30
+ max-width: 420px;
31
+ padding: var(--corn-space-6);
32
+ background: var(--corn-surface-1);
33
+ border: var(--corn-border) solid var(--corn-line);
34
+ border-radius: var(--corn-radius-lg);
35
+ box-shadow: var(--corn-shadow);
36
+ }
37
+
38
+ [data-corn="auth-brand"] { display: flex; align-items: center; gap: var(--corn-space-3); margin-bottom: var(--corn-space-5); color: var(--corn-text); }
39
+ [data-corn="auth-brand"] svg { flex: none; width: 28px; height: 28px; }
40
+ [data-corn="auth-brand"] .cf-mark-bg { fill: var(--corn-accent); }
41
+ [data-corn="auth-brand"] .cf-mark-fg { fill: var(--corn-text-on-accent); }
42
+ [data-corn="auth-brand"] .cf-mark-line { fill: none; stroke: var(--corn-text-on-accent); stroke-width: 1.5; }
43
+ [data-corn="auth-brand"] img { display: block; flex: none; max-width: 100%; }
44
+ [data-corn="auth-brand"] [data-corn="brand-logo"] { width: 28px; height: 28px; }
45
+ [data-corn="auth-brand"] [data-corn="brand-wordmark"] { height: 18px; width: auto; }
46
+ .cf-app-name { font-family: var(--corn-font-display); font-size: var(--corn-text-base); font-weight: 650; }
47
+
48
+ h1 { margin: 0 0 var(--corn-space-3); font-family: var(--corn-font-display); font-size: var(--corn-text-xl); line-height: 1.25; color: var(--corn-text); overflow-wrap: anywhere; }
49
+ p { margin: 0 0 var(--corn-space-5); color: var(--corn-text-2); }
50
+ code { font-family: var(--corn-mono); font-size: var(--corn-text-sm); color: var(--corn-text); overflow-wrap: anywhere; }
51
+ [data-corn="auth-reason"] { padding: var(--corn-space-3) var(--corn-space-4); background: var(--corn-surface-2); border: var(--corn-border) solid var(--corn-line-soft); border-radius: var(--corn-radius-sm); color: var(--corn-text); }
52
+ [data-corn-state="failure"] h1 { color: var(--corn-bad); }
53
+
54
+ form { margin: 0; }
55
+ .cf-button {
56
+ display: inline-flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ min-height: 44px;
60
+ padding: var(--corn-space-3) var(--corn-space-5);
61
+ border: var(--corn-border) solid var(--corn-accent);
62
+ border-radius: var(--corn-radius-sm);
63
+ background: var(--corn-accent);
64
+ color: var(--corn-text-on-accent);
65
+ font: inherit;
66
+ font-weight: 600;
67
+ text-decoration: none;
68
+ cursor: pointer;
69
+ }
70
+ .cf-button:hover { background: var(--corn-accent-hover); border-color: var(--corn-accent-hover); }
71
+ .cf-button[data-corn-kind="quiet"] { background: transparent; border-color: var(--corn-line); color: var(--corn-accent-text); }
72
+ .cf-button[data-corn-kind="quiet"]:hover { background: var(--corn-surface-3); }
73
+ .cf-button:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: var(--corn-focus-offset); }
@@ -13,8 +13,8 @@
13
13
  :root {
14
14
  /* Ground and surfaces */
15
15
  --corn-ground: #090d16;
16
- --corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.28) 0%, transparent 45%),
17
- radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.22) 0%, transparent 45%),
16
+ --corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.2) 0%, transparent 45%),
17
+ radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.16) 0%, transparent 45%),
18
18
  radial-gradient(circle at 50% 50%, rgba(66, 153, 225, 0.10) 0%, transparent 60%);
19
19
  --corn-surface-1: rgba(26, 34, 52, 0.72);
20
20
  --corn-surface-2: rgba(30, 41, 59, 0.8);
@@ -27,6 +27,8 @@
27
27
  --corn-shadow-color: rgba(0, 0, 0, 0.5);
28
28
  --corn-glow: 8px;
29
29
  --corn-scrim: rgba(0, 0, 0, 0.6);
30
+ /* The shadow of a phone's bottom sheet, cast upward: it takes --corn-shadow-color, so a flat brand sets it to a hard offset */
31
+ --corn-shadow-sheet: 0 -8px 24px color-mix(in srgb, var(--corn-shadow-color) 70%, transparent);
30
32
  --corn-blur: 16px;
31
33
 
32
34
  /* Text */
@@ -83,6 +85,8 @@
83
85
  --corn-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
84
86
  --corn-font-display: var(--corn-font);
85
87
  --corn-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
88
+ /* The face of numbers shown as data (counts, times, costs, PR numbers, the step counter): a pixel or display face misreads 2, 5 and 8, so a brand sets one with clear digits */
89
+ --corn-font-num: var(--corn-font);
86
90
  --corn-text-2xs: 10px;
87
91
  --corn-text-xs: 11px;
88
92
  --corn-text-sm: 12px;
@@ -100,6 +104,7 @@
100
104
  --corn-border: 1px;
101
105
  --corn-border-strong: 2px;
102
106
  --corn-focus-width: 2px;
107
+ --corn-focus-offset: 2px;
103
108
 
104
109
  /* Spacing: padding, gaps and margins are steps of this scale (or calc() over it) */
105
110
  --corn-space: 4px;
@@ -128,6 +133,10 @@
128
133
  --corn-map-label: auto;
129
134
  --corn-map-label-halo: auto;
130
135
  --corn-map-collision: var(--corn-warn);
136
+ /* The label font list (auto: the map's own stack), an ordinary line's width in px (auto: each line's own) and the glow factor (auto and 1: as drawn, 0: none) */
137
+ --corn-map-font: auto;
138
+ --corn-map-edge-width: auto;
139
+ --corn-map-glow: auto;
131
140
  /* Diff, selection and focus */
132
141
  --corn-map-added: auto;
133
142
  --corn-map-changed: auto;
@@ -195,8 +204,8 @@
195
204
  @media (prefers-color-scheme: light) {
196
205
  :root:not([data-theme="dark"]) {
197
206
  --corn-ground: #f4f6fa;
198
- --corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.12) 0%, transparent 45%),
199
- radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.07) 0%, transparent 45%);
207
+ --corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.06) 0%, transparent 45%),
208
+ radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.04) 0%, transparent 45%);
200
209
  --corn-surface-1: rgba(255, 255, 255, 0.8);
201
210
  --corn-surface-2: rgba(241, 245, 249, 0.92);
202
211
  --corn-surface-3: rgba(226, 232, 240, 0.95);
@@ -244,8 +253,8 @@
244
253
 
245
254
  :root[data-theme="light"] {
246
255
  --corn-ground: #f4f6fa;
247
- --corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.12) 0%, transparent 45%),
248
- radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.07) 0%, transparent 45%);
256
+ --corn-ground-image: radial-gradient(circle at 14% 18%, rgba(66, 153, 225, 0.06) 0%, transparent 45%),
257
+ radial-gradient(circle at 86% 82%, rgba(229, 62, 62, 0.04) 0%, transparent 45%);
249
258
  --corn-surface-1: rgba(255, 255, 255, 0.8);
250
259
  --corn-surface-2: rgba(241, 245, 249, 0.92);
251
260
  --corn-surface-3: rgba(226, 232, 240, 0.95);
package/explorer/view.js CHANGED
@@ -15,7 +15,7 @@ import { clearScenario } from './scenario-ui.js';
15
15
  import { measureParams } from './bench.js';
16
16
  import { mergeLive, placeLiveNodes } from './live-model.js';
17
17
  import { applyHouseLayout } from './house-model.js';
18
- import { t } from './strings.js';
18
+ import { syncHint } from './hint.js';
19
19
 
20
20
  const $ = (id) => document.getElementById(id);
21
21
 
@@ -166,6 +166,5 @@ export function syncViewUi() {
166
166
  if (layersBtn) layersBtn.classList.toggle('hx-layers-chip--dim', preset);
167
167
  const note = $('layers-preset-note');
168
168
  if (note) note.hidden = !preset;
169
- const badge = $('instruction-badge-text');
170
- if (badge) badge.textContent = preset ? t('hintDataFlow') : (state.isFreeform ? t('hintDrag') : t('hintInspect'));
169
+ syncHint(); // the hint's words for this view and pointer, and whether it shows (hint.js)
171
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcorn245/cornfield",
3
- "version": "0.35.0",
3
+ "version": "0.36.1",
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)",