@bongos/core 1.25.26 → 1.25.28

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.
@@ -178,13 +178,110 @@
178
178
  return { label: String(a.label), key: a.key ? String(a.key).toLowerCase() : '', bind: !!a.bind, lead: !!a.lead, run: a.run };
179
179
  }),
180
180
  keys: (Array.isArray(s.keys) ? s.keys : []).filter(function (k) { return k && k.label && k.key; }),
181
+ aim: !!s.aim,
181
182
  };
183
+ if (!scene.aim) aimAt(null);
182
184
  // Arriving at a place shows the whole glass for a moment; a scene that only registers
183
185
  // again (a toggle's row changed) does not.
184
186
  if (scene.name !== arrived) { arrived = scene.name; wake(ARRIVE_FOR); }
185
187
  render();
186
188
  }
187
189
 
190
+ // ---------- the sight is the cursor (task 1005305) ----------
191
+ // A scene that asks for it (`aim: true`: Home's city) has the sight follow the mouse, and the
192
+ // arrow is not drawn over the scene (visor.css html.visor-aim): the cursor IS the crosshair.
193
+ // Over anything that is not the scene (the glass's own controls, a window, a dialog, a field)
194
+ // the arrow is back and the sight steps aside. Before the mouse first moves, on touch, and
195
+ // when the mouse leaves the view, the sight rests at the centre as it always did.
196
+ var NOT_SCENE = '#visor, dialog, [aria-modal="true"], .opt-window, .game-menu, .hall-scrim, .toast, input, textarea, select, [contenteditable]';
197
+ function aimAt(e) {
198
+ var html = document.documentElement;
199
+ if (!html.classList) return;
200
+ var on = !!(e && scene && scene.aim && shown() && html.dataset.game === 'on');
201
+ var ui = on && !!(e.target && e.target.closest && e.target.closest(NOT_SCENE));
202
+ html.classList.toggle('visor-aim', on && !ui);
203
+ if (!root) return;
204
+ if (!on) { root.removeAttribute('data-aim'); root.style.removeProperty('--sight-x'); root.style.removeProperty('--sight-y'); return; }
205
+ root.setAttribute('data-aim', ui ? 'ui' : 'scene');
206
+ root.style.setProperty('--sight-x', e.clientX + 'px');
207
+ root.style.setProperty('--sight-y', e.clientY + 'px');
208
+ }
209
+ function onAimMove(e) { if (scene && scene.aim && (!e.pointerType || e.pointerType === 'mouse')) aimAt(e); }
210
+
211
+ // ---------- the scene's time (task 1005305) ----------
212
+ // A scene with a past (Home's city) hands the visor where it is in time: the strip under the
213
+ // top arc becomes a slider you drag, and while you are back in time the glass shows the date,
214
+ // play or pause, the speed and Back to live. { value 0…1, live, label, playing, speed, seek(f),
215
+ // play(), faster(), toLive() }, or null to take it away. The scene calls it on every change,
216
+ // so it paints in place and only re-renders the glass when a timeline comes or goes.
217
+ var timeline = null, scrubbing = false;
218
+ var ARC_X0 = 0.076, ARC_W = 0.848; // where the top arc starts and how wide it runs, of its box
219
+ function setTimeline(tl) {
220
+ var had = !!timeline;
221
+ timeline = tl && typeof tl.seek === 'function' ? tl : null;
222
+ if (!timeline) scrubbing = false;
223
+ if (had !== !!timeline || (timeline && root && !timeParts())) render();
224
+ else paintTimeline();
225
+ if (inPast()) wake(); // back in time, the date and the player stay on the glass
226
+ }
227
+ // The glass's time parts, found once per render (render drops them), not on every frame of a glide.
228
+ var tparts = null;
229
+ function timeParts() {
230
+ if (tparts && tparts.scrub.isConnected) return tparts;
231
+ var q = function (s) { return root.querySelector(s); };
232
+ var scrub = q('[data-visor-scrub]');
233
+ tparts = scrub ? { scrub: scrub, box: q('[data-visor-progress]'), words: q('[data-visor-progress-now]'), when: q('[data-visor-when]'), time: q('[data-visor-time]'), play: q('[data-visor-play]'), speed: q('[data-visor-speed]') } : null;
234
+ return tparts;
235
+ }
236
+ function paintTimeline() {
237
+ if (!timeline || !root) return;
238
+ var P = timeParts();
239
+ if (!P) return;
240
+ var scrub = P.scrub;
241
+ var pct = Math.max(0, Math.min(1, Number(timeline.value) || 0)) * 100, back = !timeline.live || !!timeline.playing;
242
+ var f = pct / 100;
243
+ scrub.style.setProperty('--scrub-x', (ARC_X0 + f * ARC_W) * 100 + '%');
244
+ scrub.style.setProperty('--scrub-y', Math.pow(1 - 2 * f, 2) * 100 + '%');
245
+ scrub.setAttribute('aria-valuenow', String(Math.round(pct)));
246
+ scrub.setAttribute('aria-valuetext', String(timeline.label || ''));
247
+ var box = P.box, words = P.words, when = P.when, time = P.time;
248
+ if (box) box.classList.toggle('visor__progress--back', back);
249
+ if (words) words.hidden = back;
250
+ if (when) { when.hidden = !back; when.textContent = String(timeline.label || ''); }
251
+ if (time) time.hidden = !back;
252
+ var play = P.play, speed = P.speed;
253
+ if (play) { play.setAttribute('aria-label', timeline.playing ? 'Pause' : 'Play'); play.classList.toggle('is-playing', !!timeline.playing); }
254
+ if (speed) { speed.textContent = String(timeline.speed || ''); speed.setAttribute('aria-label', 'Speed, ' + String(timeline.speed || '')); }
255
+ }
256
+ function seekTo(clientX) {
257
+ var P = timeline && root ? timeParts() : null;
258
+ if (!P) return;
259
+ var r = P.scrub.getBoundingClientRect();
260
+ if (r.width > 0) timeline.seek(Math.max(0, Math.min(1, ((clientX - r.left) / r.width - ARC_X0) / ARC_W)));
261
+ }
262
+ function onScrubDown(e) {
263
+ if (!timeline || e.button !== 0 || !e.target.closest || !e.target.closest('[data-visor-scrub]')) return;
264
+ e.preventDefault();
265
+ scrubbing = true;
266
+ wake();
267
+ seekTo(e.clientX);
268
+ }
269
+ function onScrubMove(e) { if (scrubbing) seekTo(e.clientX); }
270
+ function onScrubUp() { scrubbing = false; }
271
+ // On the strip, the arrows step through time (and are spent there, so the city does not move).
272
+ function onScrubKey(e) {
273
+ if (!timeline || !e.target.closest || !e.target.closest('[data-visor-scrub]')) return;
274
+ var v = Number(timeline.value) || 0, to = null;
275
+ if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') to = v - 0.02;
276
+ else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') to = v + 0.02;
277
+ else if (e.key === 'Home') to = 0;
278
+ else if (e.key === 'End') to = 1;
279
+ if (to == null) return;
280
+ e.preventDefault();
281
+ e.stopPropagation();
282
+ timeline.seek(Math.max(0, Math.min(1, to)));
283
+ }
284
+
188
285
  // ---------- resting and waking (task 1005266, owner 2026-11-13) ----------
189
286
  // The glass took a third of a laptop's height, so while you look, pan and scroll it RESTS:
190
287
  // only the arcs, the sight and your picture stay (visor.css .visor--rest). It WAKES when you
@@ -194,7 +291,7 @@
194
291
  // pointer is still there and while the keyboard is on it; it rests the moment you press or
195
292
  // wheel on the scene, and after a few idle seconds. Only on a desk with a pointer: a touch
196
293
  // screen has nothing to reach with, so a phone or tablet keeps the whole glass.
197
- var REST_AFTER = 3000, ARRIVE_FOR = 4000, REACH = 160;
294
+ var REST_AFTER = 3000, ARRIVE_FOR = 4000, REACH = 160, REACH_TOP = 110;
198
295
  var awake = true, reaching = false, restTimer = null, arrived = null, until = 0;
199
296
  // The two questions are asked of the browser once; each list keeps its own answer current,
200
297
  // so the pointer's every move reads two booleans and builds nothing.
@@ -207,7 +304,8 @@
207
304
  function keyboardOn() { return !!(root && document.activeElement && root.contains(document.activeElement)); }
208
305
  // A window the glass opened (the options, your profile, the game menu; task 1005253) holds it too.
209
306
  function windowUp() { var c = document.documentElement.classList; return !!(c && (c.contains('opt-window-open') || c.contains('game-menu-open'))); }
210
- function held() { return !!sheet || !!focus || reaching || keyboardOn() || windowUp(); }
307
+ function inPast() { return scrubbing || !!(timeline && (!timeline.live || timeline.playing)); } // task 1005305
308
+ function held() { return !!sheet || !!focus || reaching || keyboardOn() || windowUp() || inPast(); }
211
309
  function resting() { return !awake && canRest(); }
212
310
  function paintRest() { if (root && root.classList) root.classList.toggle('visor--rest', resting()); }
213
311
  // Waking only moves the hour it may rest at; one clock is ever running, so a pointer
@@ -254,7 +352,7 @@
254
352
  function onRoot(e) { return !!(root && e.target && e.target.nodeType === 1 && root.contains(e.target)); }
255
353
  function onPointerMove(e) {
256
354
  if (!shown() || e.buttons || e.pointerType === 'touch') return; // a drag is looking, not reaching
257
- reaching = onRoot(e) || e.clientY >= window.innerHeight - REACH;
355
+ reaching = onRoot(e) || e.clientY >= window.innerHeight - REACH || (!!timeline && e.clientY <= REACH_TOP);
258
356
  if (reaching) wake();
259
357
  }
260
358
  function onPointerDown(e) { if (!shown()) return; if (onRoot(e)) wake(); else rest(); }
@@ -417,6 +515,7 @@
417
515
  var sprite = C && typeof C.portraitSrc === 'function' ? C.portraitSrc(id) : (C && typeof C.spriteSrc === 'function' ? C.spriteSrc(id) : '');
418
516
  var n = credits();
419
517
  return frameSvg() +
518
+ scrubHtml() + // before the top line, so the line's buttons stand over the drag band
420
519
  '<div class="visor__top">' + (scene.place ? '<p class="visor__place">' + esc(scene.place) + '</p>' : '') + progressHtml() + '</div>' +
421
520
  focusHtml() +
422
521
  '<div class="visor__foot">' +
@@ -452,13 +551,30 @@
452
551
  '<span class="visor__card-open">Open your profile</span></span>';
453
552
  }
454
553
  // The version's reading in words, beside the place; the four segments are the top arc
455
- // (arcSegs, task 1005266), so the bars are never the only reading.
554
+ // (arcSegs, task 1005266), so the bars are never the only reading. With a scene's time
555
+ // (task 1005305) the date and the player stand beside it while you are back in time.
456
556
  function progressHtml() {
457
- if (!progress) return '';
458
- var said = progress.id + (progress.name ? ', ' + progress.name : '') + ': ' + progress.pct + '% built';
459
- return '<div class="visor__progress" data-visor-progress title="' + esc(said) + '">' +
460
- '<p class="visor__progress-words"><span class="sr-only">' + esc(said) + '</span>' +
461
- '<span aria-hidden="true">' + esc(progress.id) + ' · ' + progress.pct + '%</span></p></div>';
557
+ if (!progress && !timeline) return '';
558
+ var said = progress ? progress.id + (progress.name ? ', ' + progress.name : '') + ': ' + progress.pct + '% built' : '';
559
+ var words = progress ? '<p class="visor__progress-words" data-visor-progress-now><span class="sr-only">' + esc(said) + '</span>' +
560
+ '<span aria-hidden="true">' + esc(progress.id) + ' · ' + progress.pct + '%</span></p>' : '';
561
+ if (!timeline) return '<div class="visor__progress" data-visor-progress title="' + esc(said) + '">' + words + '</div>';
562
+ return '<div class="visor__progress visor__progress--time" data-visor-progress>' + words +
563
+ '<p class="visor__progress-words visor__when" data-visor-when hidden></p>' +
564
+ '<div class="visor__time" data-visor-time role="group" aria-label="Time" hidden>' +
565
+ '<button class="visor__tbtn visor__tbtn--play" type="button" data-visor-play aria-label="Play">' +
566
+ '<svg class="visor__tplay" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 3v10l8-5z"/></svg>' +
567
+ '<svg class="visor__tpause" viewBox="0 0 16 16" aria-hidden="true"><path d="M4.5 3h2.4v10H4.5zM9.1 3h2.4v10H9.1z"/></svg></button>' +
568
+ '<button class="visor__tbtn" type="button" data-visor-speed></button>' +
569
+ '<button class="visor__tbtn" type="button" data-visor-live>Back to live</button>' +
570
+ '</div></div>';
571
+ }
572
+ // The top arc is the slider (task 1005305): a band over it takes the drag, and a mark rides
573
+ // the curve where you are in time. Same box as the arc's own svg, so the two always line up.
574
+ function scrubHtml() {
575
+ if (!timeline) return '';
576
+ return '<div class="visor__frame visor__frame--top visor__scrub" data-visor-scrub role="slider" tabindex="0" aria-orientation="horizontal" aria-valuemin="0" aria-valuemax="100" ' +
577
+ 'aria-label="Time: drag along the top arc to go back through the weeks" title="Drag to go back in time"><i class="visor__scrub-at" aria-hidden="true"></i></div>';
462
578
  }
463
579
  // Options lives only in here (the owner, 2026-11-12), on a key of its own: Escape is Close.
464
580
  function sheetHtml(id) {
@@ -482,7 +598,7 @@
482
598
  if (!document.body) return;
483
599
  var id = scene && !embedded() ? character() : null;
484
600
  var html = document.documentElement;
485
- if (!id) { if (html.classList) html.classList.remove('visor-on'); if (root) { closeSheet(false); root.hidden = true; } return; }
601
+ if (!id) { if (html.classList) html.classList.remove('visor-on'); if (root) { closeSheet(false); root.hidden = true; } aimAt(null); return; }
486
602
  // A scene's own layers read this to keep clear of the glass (thinking.css), in game mode only.
487
603
  if (html.classList) html.classList.toggle('visor-on', html.dataset.game === 'on');
488
604
  if (!root) {
@@ -492,6 +608,8 @@
492
608
  root.setAttribute('role', 'region');
493
609
  root.setAttribute('aria-label', 'Visor');
494
610
  root.addEventListener('click', onClick);
611
+ root.addEventListener('pointerdown', onScrubDown);
612
+ root.addEventListener('keydown', onScrubKey);
495
613
  root.addEventListener('focusin', function (e) { wake(); nameHint(e); });
496
614
  root.addEventListener('focusout', nameHint);
497
615
  root.addEventListener('mouseover', nameHint);
@@ -504,6 +622,8 @@
504
622
  root.hidden = false;
505
623
  root.setAttribute('data-character', id);
506
624
  root.innerHTML = glassHtml(id);
625
+ tparts = null;
626
+ paintTimeline();
507
627
  if (open) openSheet();
508
628
  }
509
629
  function embedded() {
@@ -582,6 +702,9 @@
582
702
  if (t.closest('[data-visor-unfocus]')) { dropFocus(); return; }
583
703
  if (t.closest('[data-visor-lead]')) { if (focus && focus.lead && !focus.lead.busy) { closeSheet(false); focus.lead.run(); } return; }
584
704
  if (t.closest('[data-visor-sheet]')) { openSheet(); return; }
705
+ if (timeline && t.closest('[data-visor-play]')) { timeline.play(); return; }
706
+ if (timeline && t.closest('[data-visor-speed]')) { timeline.faster(); return; }
707
+ if (timeline && t.closest('[data-visor-live]')) { timeline.toLive(); return; }
585
708
  if (t.closest('[data-game-menu]')) { closeSheet(false); return; } // shell-game.js opens the menu
586
709
  // You: your profile in the game's window, the place still drawn behind it. With no
587
710
  // window (shell-game.js absent), the link opens the profile page.
@@ -644,6 +767,11 @@
644
767
 
645
768
  function start() {
646
769
  window.addEventListener('keydown', onKey);
770
+ window.addEventListener('pointermove', onAimMove);
771
+ window.addEventListener('pointermove', onScrubMove);
772
+ window.addEventListener('pointerup', onScrubUp);
773
+ window.addEventListener('pointercancel', onScrubUp);
774
+ document.addEventListener('pointerleave', function (e) { if (e.target === document.documentElement) aimAt(null); }, true);
647
775
  // Resting and waking: all three listen in capture and are passive, so they see a press or
648
776
  // a wheel a scene stops, and never slow or change one (ADR 0399 §2.1: the glass is not layout).
649
777
  window.addEventListener('pointermove', onPointerMove, { capture: true, passive: true });
@@ -666,6 +794,8 @@
666
794
  // a scene's pick: OTBVisor.focus({ title, status, lines, lead: { label, run }, onClose }) or focus(null)
667
795
  focus: setFocus,
668
796
  focused: function () { return focus ? focus.key : null; },
797
+ // a scene's time: OTBVisor.timeline({ value, live, label, playing, speed, seek, play, faster, toLive }) or timeline(null)
798
+ timeline: setTimeline,
669
799
  render: render,
670
800
  open: openSheet,
671
801
  close: function () { closeSheet(true); },
@@ -221,6 +221,17 @@ The same city, repainted (owner direction, 2026-11-11; ADR 0402's amendment and
221
221
  - **The hour** is `sky-time.js` (loaded before the painter): the viewer's clock, or `/?hour=13` to pin it.
222
222
  - Pinned by `tests/home_city.mjs` (tokens only, the cloud's place in the draw order) and `tests/hall_sky_time.mjs`.
223
223
 
224
+ ## Game mode: the city is the whole view (task 1005305)
225
+
226
+ The owner, 2026-11-14: in game mode the builder's Home is only the city, moved like a base-building game, with no scroll.
227
+
228
+ - **Where it applies.** Game mode, and Home showing the city (`home-city.js` `world()`, which stamps `html.hc-world`). The artist's gallery and classic mode are unchanged.
229
+ - **What left the scene.** The greeting, the banner, band and main zones (the cards under the city), the foot, the ladder and the time slider (`home-city.css`). The page cannot scroll. The cards hold actions (join requests, invitations, triage) that game mode now reaches nowhere; classic mode still shows them.
230
+ - **The camera** is `home-camera.js`, the scene's own (ADR 0399: the visor owns none). The city's `<svg>` is sized to 1.35 views at least on both axes and moved with a transform: the arrow keys, a drag (a drag's closing click is not a tap on a tower), and the cursor resting within 56px of an edge of the view. It never shows past an edge. It waits while a window, a dialog or the visor's sheet is up, and the cursor pushes only from the scene, never from over the glass's buttons.
231
+ - **Time is the visor's** (ADR 0403): `OTBVisor.timeline` gets the week, and the scene's rows are Play (P), Speed (S, 1× 2× 4×), Back to live (L) and Back to the middle of the city (H). See `visor.md`.
232
+ - **Not done:** zoom; the other game places (the gallery, the Governor City, the windows) still scroll where they did; a phone has no time strip on the glass (the rows in the Actions sheet work).
233
+ - Tests: `tests/home_camera.mjs` (the maths), `tests/home_city_world.mjs` (a real browser, game and classic).
234
+
224
235
  ## Private areas
225
236
 
226
237
  A private goal the viewer is neither a member of nor an Archon over still stands as a tower (its counts are structure), but the server sends no title for it or for the ideas tied to it; the drawing labels them "A private area" and "A private idea" (ADR 0112, as the goal map and the sky apply it). Pinned in `tests/home_city.mjs`.
@@ -20,6 +20,12 @@ The owner: the design and the theme are right, but the glass took too much of th
20
20
 
21
21
  Tests: `tests/hall_visor.mjs` (rest, wake, the drag that is not a reach, the sheet holding it awake, the unseen control, the key's name, the arc's pieces, a phone).
22
22
 
23
+ ## The sight is the cursor, and a scene's time is on the glass (task 1005305, owner 2026-11-14)
24
+
25
+ - **The sight follows the mouse** in a scene registered with `aim: true` (Home's city is the first), and the arrow is not drawn over the scene (`html.visor-aim`), so the cursor is the crosshair. Over the glass's own controls, a window, a dialog or a field the arrow is back and the sight steps aside. Before the mouse moves, on touch, and when the mouse leaves the view, the sight rests at the centre. Other scenes are unchanged until they ask.
26
+ - **`OTBVisor.timeline({ value, live, label, playing, speed, seek, play, faster, toLive })`** (or `null`): the top arc, which is the version's progress (task 1005266), is also the slider. A band over the arc (`.visor__scrub`, `role="slider"`, the arc's own box) takes the drag, and a mark rides the curve where you are in time; focused, the arrows, Home and End step it. Back in time the version words give way to the date, with play or pause, the speed and Live beside it on the top line, and the glass stays awake; with a timeline, the pointer near the top of the view wakes the glass too. The scene calls it on every change, so it paints in place; the glass re-renders only when a timeline comes or goes.
27
+ - Tests: `tests/hall_visor.mjs` (a real mouse: the sight follows it and the arrow is gone over the scene and back over a control; a drag along the arc, the mark on the curve, the date, play, speed, Back to live, and the arrow keys on the slider) and `tests/home_city_world.mjs` (Home's side).
28
+
23
29
  ## A window the glass opens opens in the glass (task 1005253, owner 2026-11-13)
24
30
 
25
31
  - **The bug.** The options window and your profile window (`shell-game.js` `openOverlay`, `.opt-window`), and the game menu (`openMenu`, `.game-menu`, task 1005250), are reached from the visor, yet they opened as a box over the whole screen and covered the visor itself: the arcs, the place, your credits, the accent button and the hints.
@@ -339,7 +339,9 @@ module.exports = { build, blockVars };
339
339
 
340
340
  if (require.main === module) {
341
341
  const next = build();
342
- const current = fs.existsSync(OUT) ? fs.readFileSync(OUT, 'utf8') : '';
342
+ // task 1005296: compare content, not line endings. A `core.autocrlf=true` checkout reads
343
+ // brand.html back as CRLF while build() is LF, which read as stale forever.
344
+ const current = fs.existsSync(OUT) ? fs.readFileSync(OUT, 'utf8').replace(/\r\n/g, '\n') : '';
343
345
  if (process.argv.includes('--check')) {
344
346
  if (current === next) process.stdout.write('brand.html: current\n');
345
347
  else {
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.25.26",
3
+ "version": "1.25.28",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@bongos/core",
9
- "version": "1.25.26",
9
+ "version": "1.25.28",
10
10
  "license": "AGPL-3.0-or-later",
11
11
  "dependencies": {
12
12
  "express": "^4.21.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bongos/core",
3
- "version": "1.25.26",
3
+ "version": "1.25.28",
4
4
  "description": "Cloud Bongos — the AI-first build platform core (GDS + platform surfaces + module system), installed as a versioned dependency (ADR 0108).",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "main": "src/platform-server.js",
@@ -11924,5 +11924,21 @@
11924
11924
  "id": "1005266",
11925
11925
  "text": "In game mode the visor now steps out of the way while you look around and fades back in, slimmer than before, when you reach for a command."
11926
11926
  }
11927
+ ],
11928
+ "1.25.27": [
11929
+ {
11930
+ "id": "1005296",
11931
+ "text": "The pre-ship health check no longer wrongly says the brand page and logo files are out of date on Windows computers."
11932
+ },
11933
+ {
11934
+ "id": "1005197",
11935
+ "text": "A hall check that always failed on Windows computers now works there, so it can again spot a page loading its scripts in the wrong order."
11936
+ }
11937
+ ],
11938
+ "1.25.28": [
11939
+ {
11940
+ "id": "1005305",
11941
+ "text": "In game mode the builder's Home is now just the city: no scrolling, you move around with the arrow keys, by dragging, or by resting the cursor at a screen edge, and you rewind and replay the city's history from the visor's top"
11942
+ }
11927
11943
  ]
11928
11944
  }
@@ -35,6 +35,7 @@ const path = require('node:path');
35
35
  const crypto = require('node:crypto');
36
36
  const { readMarkSource, markParts, markFile, faviconSvg } = require('../../src/brand-mark');
37
37
  const { escapeHtml } = require('../../src/html-escape');
38
+ const { sameContent } = require('./gen-freshness'); // eol-insensitive freshness (CRLF checkouts, task 1005296)
38
39
 
39
40
  const ROOT = path.resolve(__dirname, '..', '..');
40
41
 
@@ -158,7 +159,7 @@ async function main() {
158
159
  for (const [name, text] of Object.entries(files)) {
159
160
  const file = path.join(dir, name);
160
161
  const cur = fs.existsSync(file) ? fs.readFileSync(file, 'utf8') : null;
161
- if (cur === text) continue;
162
+ if (cur !== null && sameContent(cur, text)) continue;
162
163
  stale.push(name);
163
164
  if (!args.includes('--check')) fs.writeFileSync(file, text);
164
165
  }
package/src/module-api.js CHANGED
@@ -81,7 +81,7 @@ const { sleep } = require('./sleep');
81
81
  // MAJOR (see allowBoxScope below): passes the request through untouched.
82
82
  function deprecatedNoopMiddleware(_req, _res, next) { next(); }
83
83
 
84
- const CORE_VERSION = '1.25.26'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
84
+ const CORE_VERSION = '1.25.28'; // CI auto-patch carrier (ADR 0161); changelog: docs/module-api-changelog.md
85
85
 
86
86
  // A namespaced logger so a module's log lines are attributable + consistent.
87
87
  // Usage: const log = api.logger('discord'); log.info('mounted');
@@ -95,7 +95,8 @@ test('the brand folder holds exactly what gen-brand.js writes from the source (l
95
95
  const { brandFiles, packColors } = require('../scripts/bongos/gen-brand.js');
96
96
  const files = brandFiles(read(BRAND_DIR, 'mark.svg'), packColors());
97
97
  for (const [name, text] of Object.entries(files)) {
98
- assert.equal(read(BRAND_DIR, name), text, `${name} is stale — run node scripts/bongos/gen-brand.js`);
98
+ assert.equal(read(BRAND_DIR, name).replace(/\r\n/g, '\n'), text, // CRLF checkouts (task 1005296)
99
+ `${name} is stale — run node scripts/bongos/gen-brand.js`);
99
100
  }
100
101
  const c = packColors();
101
102
  assert.match(files['mark-light.svg'], new RegExp(c.ink));
@@ -99,6 +99,7 @@ const GENERATOR_SOURCES = [
99
99
  'modules/hall-ui/public/controls.css',
100
100
  'modules/hall-ui/public/dom-utils.js',
101
101
  'scripts/bongos/gen-brand.js',
102
+ 'scripts/bongos/gen-freshness.js',
102
103
  'src/brand-mark.js',
103
104
  'src/html-escape.js',
104
105
  'DESIGN.md',
@@ -135,6 +136,26 @@ test('the freshness gate passes on a fresh tree and fails when the token sheet c
135
136
  }
136
137
  });
137
138
 
139
+ // task 1005296: a `core.autocrlf=true` checkout (every default Windows clone) hands the
140
+ // generators CRLF copies of brand.html and the logo SVGs, while they build LF. Freshness is
141
+ // about content, so line endings alone must not read as stale — but a real edit still must.
142
+ test('the freshness gate ignores CRLF line endings on the brand page and the logo set', () => {
143
+ const dir = copiedTree();
144
+ const toCrlf = (f) => fs.writeFileSync(f, fs.readFileSync(f, 'utf8').replace(/\r\n/g, '\n').replace(/\n/g, '\r\n'));
145
+ try {
146
+ const page = path.join(dir, 'modules/ui-design/public/brand.html');
147
+ const brand = path.join(dir, 'modules/ui-design/public/brand');
148
+ toCrlf(page);
149
+ for (const f of fs.readdirSync(brand).filter((n) => n.endsWith('.svg'))) toCrlf(path.join(brand, f));
150
+ assert.ok(fs.readFileSync(page, 'utf8').includes('\r\n'), 'the brand page should now carry CRLF');
151
+ assert.deepEqual(checkDesignGeneratorsFresh(dir), [], 'CRLF alone must not read as stale');
152
+ fs.appendFileSync(page, '<!-- hand edit -->\r\n');
153
+ assert.ok(checkDesignGeneratorsFresh(dir).some((x) => x.startsWith('modules/ui-design/public/brand.html')), 'a real edit must still read as stale');
154
+ } finally {
155
+ fs.rmSync(dir, { recursive: true, force: true });
156
+ }
157
+ });
158
+
138
159
  // task 1005133: the logo set joins the gate. Editing the one source (mark.svg) without
139
160
  // running gen-brand.js fails it; so does a PNG whose source page moved (the pack's ground)
140
161
  // or a PNG swapped by hand — the PNGs are checked by hash, not just their pixel size.
@@ -48,7 +48,7 @@ function sources() {
48
48
  // ── 1. generated ─────────────────────────────────────────────────────────────
49
49
 
50
50
  test('the committed page is exactly what the generator writes', () => {
51
- assert.equal(PAGE, gen.build(),
51
+ assert.equal(PAGE.replace(/\r\n/g, '\n'), gen.build(), // CRLF checkouts (task 1005296)
52
52
  'modules/ui-design/public/brand.html is stale or hand-edited: run node modules/ui-design/scripts/gen-design-reference.js');
53
53
  });
54
54
 
@@ -290,10 +290,29 @@ test('the guard catches a browser box when one comes back, and leaves the shared
290
290
  }
291
291
  });
292
292
 
293
+ // shell.js's tag, then hall-dialog.js's on the very next line. Either line ending: git's
294
+ // core.autocrlf checks every page out with CRLF on Windows, and an LF-only `\n` here failed every
295
+ // page there, so a real misordering (task 1005148's visor.js between the two) read as noise.
296
+ // Task 1005197.
297
+ function shellThenDialog(html) {
298
+ return html.match(/<script src="\/builders\/shell\.js[^"]*"( defer)?><\/script>\r?\n<script src="\/builders\/hall-dialog\.js"( defer)?><\/script>/);
299
+ }
300
+
301
+ test('the shell-then-dialog order check reads LF and CRLF pages alike, and still catches a misorder', () => {
302
+ const pair = ['<script src="/builders/shell.js?v=1" defer></script>', '<script src="/builders/hall-dialog.js" defer></script>'];
303
+ for (const eol of ['\n', '\r\n']) {
304
+ const m = shellThenDialog(pair.join(eol));
305
+ assert.ok(m, `matched with ${JSON.stringify(eol)} line endings`);
306
+ assert.equal(m[1], m[2]);
307
+ const between = [pair[0], '<script src="/builders/visor.js" defer></script>', pair[1]].join(eol);
308
+ assert.equal(shellThenDialog(between), null, `a script between them is caught with ${JSON.stringify(eol)}`);
309
+ }
310
+ });
311
+
293
312
  test('every hall page loads the shared dialog right after the shell, deferred alike', () => {
294
313
  for (const f of fs.readdirSync(PUB).filter((n) => n.endsWith('.html'))) {
295
314
  const html = read(f);
296
- const shell = html.match(/<script src="\/builders\/shell\.js[^"]*"( defer)?><\/script>\n<script src="\/builders\/hall-dialog\.js"( defer)?><\/script>/);
315
+ const shell = shellThenDialog(html);
297
316
  if (!/\/builders\/shell\.js/.test(html)) continue;
298
317
  assert.ok(shell, `${f} loads hall-dialog.js right after shell.js`);
299
318
  assert.equal(shell[1], shell[2], `${f}: deferred alike`);
@@ -653,3 +653,77 @@ test('a phone keeps the whole glass: there is no pointer to reach with (task 100
653
653
  assert.deepEqual(await page.evaluate(() => [OTBVisor.resting(), document.getElementById('visor').classList.contains('visor--rest'), getComputedStyle(document.querySelector('.visor__main')).opacity]), [false, false, '1']);
654
654
  await ctx.close();
655
655
  });
656
+
657
+ // ---------- the sight is the cursor, and a scene's time rides the top arc (task 1005305) ----------
658
+ const withTime = (page) => page.evaluate(() => {
659
+ window.tl = { value: 1, live: true, label: 'Live', playing: false, speed: '1×', plays: 0, lives: 0 };
660
+ const hand = () => window.OTBVisor.timeline({
661
+ value: window.tl.value, live: window.tl.live, label: window.tl.label, playing: window.tl.playing, speed: window.tl.speed,
662
+ seek(f) { window.tl.value = f; window.tl.live = f > 0.999; window.tl.label = window.tl.live ? 'Live' : 'week ' + Math.round(f * 10); hand(); },
663
+ play() { window.tl.plays++; window.tl.playing = !window.tl.playing; hand(); },
664
+ faster() { window.tl.speed = '2×'; hand(); },
665
+ toLive() { window.tl.lives++; window.tl.playing = false; window.tl.value = 1; window.tl.live = true; window.tl.label = 'Live'; hand(); },
666
+ });
667
+ window.OTBVisor.scene(Object.assign({}, window.__visorScene, { aim: true }));
668
+ hand();
669
+ });
670
+
671
+ test('a scene that asks has the sight follow the mouse with no arrow over it; over a control of the glass the arrow is back', { skip }, async () => {
672
+ const { ctx, page, errors } = await open();
673
+ const before = await page.evaluate(() => { const r = document.querySelector('.visor__sight').getBoundingClientRect(); return [Math.round(r.x + r.width / 2), Math.round(r.y + r.height / 2)]; });
674
+ await page.mouse.move(300, 420);
675
+ const plain = await page.evaluate(() => ({ aim: document.documentElement.classList.contains('visor-aim'), cursor: getComputedStyle(document.getElementById('world')).cursor }));
676
+ await withTime(page);
677
+ await page.mouse.move(310, 430);
678
+ const scene = await page.evaluate(() => { const r = document.querySelector('.visor__sight').getBoundingClientRect(); return { at: [Math.round(r.x + r.width / 2), Math.round(r.y + r.height / 2)], cursor: getComputedStyle(document.getElementById('world')).cursor, aim: document.getElementById('visor').dataset.aim }; });
679
+ const main = await page.evaluate(() => { const r = document.querySelector('.visor__main').getBoundingClientRect(); return [r.x + r.width / 2, r.y + r.height / 2]; });
680
+ await page.mouse.move(main[0], main[1]);
681
+ const ui = await page.evaluate(() => ({ aim: document.getElementById('visor').dataset.aim, on: document.documentElement.classList.contains('visor-aim'), sight: getComputedStyle(document.querySelector('.visor__sight')).visibility }));
682
+ await ctx.close();
683
+ assert.deepEqual(before, [640, 400], 'before the mouse moves the sight rests at the centre');
684
+ assert.deepEqual(plain, { aim: false, cursor: 'auto' }, 'a scene that does not ask keeps the arrow and the centred sight');
685
+ assert.deepEqual(scene, { at: [310, 430], cursor: 'none', aim: 'scene' }, 'the sight is where the mouse is, and the arrow is not drawn');
686
+ assert.deepEqual(ui, { aim: 'ui', on: false, sight: 'hidden' }, 'over the accent button the arrow is back and the sight steps aside');
687
+ assert.deepEqual(errors, []);
688
+ });
689
+
690
+ test('dragging along the top arc goes back in time; the date and the player show, and its buttons and the arrow keys work', { skip }, async () => {
691
+ const { ctx, page, errors } = await open();
692
+ const none = await page.evaluate(() => !!document.querySelector('[data-visor-scrub]'));
693
+ await withTime(page);
694
+ const band = await page.evaluate(() => { const r = document.querySelector('[data-visor-scrub]').getBoundingClientRect(); return { x: r.x, y: r.y, w: r.width, h: r.height, timeHidden: document.querySelector('[data-visor-time]').hidden, role: document.querySelector('[data-visor-scrub]').getAttribute('role') }; });
695
+ const xAt = (f) => band.x + band.w * (0.076 + 0.848 * f);
696
+ await page.mouse.move(xAt(0.8), band.y + band.h / 2);
697
+ await page.mouse.down();
698
+ await page.mouse.move(xAt(0.5), band.y + band.h / 2 + 200, { steps: 4 }); // the drag holds off the band too
699
+ await page.mouse.up();
700
+ const back = await page.evaluate(() => { const m = document.querySelector('.visor__scrub-at').getBoundingClientRect(), b = document.querySelector('[data-visor-scrub]').getBoundingClientRect(); return { value: window.tl.value, when: document.querySelector('[data-visor-when]').textContent, whenHidden: document.querySelector('[data-visor-when]').hidden, timeHidden: document.querySelector('[data-visor-time]').hidden, now: document.querySelector('[data-visor-scrub]').getAttribute('aria-valuenow'), markX: (m.x + m.width / 2 - b.x) / b.width, live: document.querySelector('[data-visor-live]').textContent, rest: document.getElementById('visor').classList.contains('visor--rest') }; });
701
+ await page.mouse.move(640, 400); // let go: moving on does not drag
702
+ const after = await page.evaluate(() => window.tl.value);
703
+ await page.click('[data-visor-play]');
704
+ await page.click('[data-visor-speed]');
705
+ const played = await page.evaluate(() => ({ plays: window.tl.plays, label: document.querySelector('[data-visor-play]').getAttribute('aria-label'), speed: document.querySelector('[data-visor-speed]').textContent }));
706
+ await page.focus('[data-visor-scrub]');
707
+ await page.keyboard.press('ArrowLeft');
708
+ const stepped = await page.evaluate(() => window.tl.value);
709
+ await page.keyboard.press('Home');
710
+ const home = await page.evaluate(() => window.tl.value);
711
+ await page.click('[data-visor-live]');
712
+ const live = await page.evaluate(() => ({ lives: window.tl.lives, timeHidden: document.querySelector('[data-visor-time]').hidden }));
713
+ await page.evaluate(() => window.OTBVisor.timeline(null));
714
+ const gone = await page.evaluate(() => !!document.querySelector('[data-visor-scrub]'));
715
+ await ctx.close();
716
+ assert.equal(none, false, 'a scene with no time has no slider');
717
+ assert.equal(band.role, 'slider');
718
+ assert.equal(band.timeHidden, true, 'at live the player is not shown');
719
+ assert.ok(Math.abs(back.value - 0.5) < 0.02, 'the drag ends half way back: ' + back.value);
720
+ assert.ok(Math.abs(back.markX - (0.076 + 0.848 * 0.5)) < 0.02, 'the mark rides the arc at the same place');
721
+ assert.deepEqual([back.when, back.whenHidden, back.timeHidden, back.now, back.live, back.rest], ['week 5', false, false, '50', 'Back to live', false]);
722
+ assert.equal(after, back.value, 'after the press ends, moving the mouse changes nothing');
723
+ assert.deepEqual(played, { plays: 1, label: 'Pause', speed: '2×' });
724
+ assert.ok(stepped < back.value && stepped > back.value - 0.05, 'the left arrow steps back a little');
725
+ assert.equal(home, 0, 'Home goes to the start');
726
+ assert.deepEqual(live, { lives: 1, timeHidden: true });
727
+ assert.equal(gone, false, 'the scene taking its time away takes the slider away');
728
+ assert.deepEqual(errors, []);
729
+ });
@@ -0,0 +1,34 @@
1
+ // tests/home_camera.mjs — the camera over Home's city in game mode (task 1005305).
2
+ // Runs home-camera.js's own maths: the world is always larger than the view, the camera
3
+ // never shows past an edge, and the cursor pushes only when it rests near a side.
4
+ import test from 'node:test';
5
+ import assert from 'node:assert/strict';
6
+ import { createRequire } from 'node:module';
7
+
8
+ const require = createRequire(import.meta.url);
9
+ const Cam = require('../modules/hall-ui/public/home-camera.js');
10
+
11
+ test('the world keeps the drawing\'s shape and is larger than the view on both axes', () => {
12
+ for (const [vw, vh] of [[1280, 800], [390, 844], [2560, 1080]]) {
13
+ const s = Cam.worldSize(vw, vh, 1000, 793);
14
+ assert.ok(s.w >= vw * Cam.OVER - 1 && s.h >= vh * Cam.OVER - 1, `${vw}x${vh} -> ${s.w}x${s.h}`);
15
+ assert.ok(Math.abs(s.w / s.h - 1000 / 793) < 0.01, 'the drawing is not stretched');
16
+ }
17
+ assert.deepEqual(Cam.worldSize(0, 800, 1000, 793), { w: 0, h: 0 }, 'no view, no world');
18
+ });
19
+
20
+ test('the camera never shows past an edge of the world', () => {
21
+ assert.equal(Cam.clamp(50, 1280, 2000), 0, 'not past the left edge');
22
+ assert.equal(Cam.clamp(-5000, 1280, 2000), -720, 'not past the right edge');
23
+ assert.equal(Cam.clamp(-300, 1280, 2000), -300, 'anywhere between is kept');
24
+ });
25
+
26
+ test('the cursor pushes only near a side, harder the closer it is, and toward that side', () => {
27
+ assert.equal(Cam.edgePush(640, 1280), 0, 'the middle of the view does not move the city');
28
+ assert.equal(Cam.edgePush(Cam.EDGE + 1, 1280), 0);
29
+ assert.ok(Cam.edgePush(10, 1280) > Cam.edgePush(40, 1280) && Cam.edgePush(40, 1280) > 0, 'left side: the view goes left');
30
+ assert.ok(Cam.edgePush(1275, 1280) < Cam.edgePush(1240, 1280) && Cam.edgePush(1240, 1280) < 0, 'right side: the view goes right');
31
+ assert.equal(Cam.edgePush(0, 1280), 1);
32
+ assert.equal(Cam.edgePush(1280, 1280), -1);
33
+ assert.equal(Cam.edgePush(null, 1280), 0, 'no cursor, no push');
34
+ });