@bongos/core 1.25.27 → 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.
- package/.bongos-core.json +39 -24
- package/docs/copy-inventory.md +14 -11
- package/docs/copy-registry.json +42 -15
- package/docs/module-api-changelog.md +2 -0
- package/docs/page-inventory.json +1 -0
- package/docs/page-readings.json +8 -8
- package/modules/hall-ui/public/home-camera.js +188 -0
- package/modules/hall-ui/public/home-city.css +14 -0
- package/modules/hall-ui/public/home-city.js +60 -5
- package/modules/hall-ui/public/index.html +6 -4
- package/modules/hall-ui/public/visor.css +37 -0
- package/modules/hall-ui/public/visor.js +140 -10
- package/modules/hall-ui/records/home-city.md +11 -0
- package/modules/hall-ui/records/visor.md +6 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/release-notes.json +6 -0
- package/src/module-api.js +1 -1
- package/tests/hall_visor.mjs +74 -0
- package/tests/home_camera.mjs +34 -0
- package/tests/home_city_world.mjs +119 -0
|
@@ -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
|
|
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
|
-
|
|
460
|
-
'<
|
|
461
|
-
|
|
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.
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bongos/core",
|
|
3
|
-
"version": "1.25.
|
|
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.
|
|
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.
|
|
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",
|
package/release-notes.json
CHANGED
|
@@ -11934,5 +11934,11 @@
|
|
|
11934
11934
|
"id": "1005197",
|
|
11935
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
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
|
+
}
|
|
11937
11943
|
]
|
|
11938
11944
|
}
|
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.
|
|
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');
|
package/tests/hall_visor.mjs
CHANGED
|
@@ -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
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// tests/home_city_world.mjs — game mode: Home's city is the whole view (task 1005305).
|
|
2
|
+
//
|
|
3
|
+
// Runs city-draw.js + home-city-draw.js + home-camera.js + home-city.js in a real page with
|
|
4
|
+
// html[data-game="on"]: the page holds nothing but the city and cannot scroll, the arrow keys
|
|
5
|
+
// move the world and never past its edge, the time is handed to the visor (OTBVisor.timeline)
|
|
6
|
+
// and a drag on it sends the city back through the weeks, and classic mode is as it was.
|
|
7
|
+
// Skips where no system Edge or Chrome is installed.
|
|
8
|
+
//
|
|
9
|
+
// Run: node --test tests/home_city_world.mjs
|
|
10
|
+
import assert from 'node:assert/strict';
|
|
11
|
+
import { test, after } from 'node:test';
|
|
12
|
+
import { createRequire } from 'node:module';
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
|
|
17
|
+
const require = createRequire(import.meta.url);
|
|
18
|
+
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
|
+
const lib = require(path.join(ROOT, 'modules', 'ui-design', 'kit', 'lib.js'));
|
|
20
|
+
const pub = (f) => fs.readFileSync(path.join(ROOT, 'modules', 'hall-ui', 'public', f), 'utf8');
|
|
21
|
+
const FIXTURE = fs.readFileSync(path.join(ROOT, 'scripts', 'hall-preview', 'fixtures', 'home__city.json'), 'utf8');
|
|
22
|
+
|
|
23
|
+
let browser = null;
|
|
24
|
+
try { browser = await lib.launchBrowser(); } catch (e) { if (!(e instanceof lib.NoBrowserError)) throw e; }
|
|
25
|
+
after(() => browser && browser.close());
|
|
26
|
+
const skip = !browser && 'no system Edge or Chrome';
|
|
27
|
+
|
|
28
|
+
const stubs = `
|
|
29
|
+
window.__CITY = ${FIXTURE};
|
|
30
|
+
window.BongosClient = { createClient: () => ({ request: async (m, p) =>
|
|
31
|
+
(p.startsWith('/api/bongos/home/city') ? { ok: true, status: 200, data: window.__CITY } : { ok: false, status: 404, data: null }) }) };
|
|
32
|
+
window.OTBCraftMode = { iconHtml: () => '', choose: () => {}, current: () => 'artisan' };
|
|
33
|
+
document.documentElement.dataset.craft = 'artisan';
|
|
34
|
+
window.__tl = []; window.__scenes = [];
|
|
35
|
+
window.OTBVisor = { timeline: (t) => window.__tl.push(t), scene: (s) => window.__scenes.push(s), isOpen: () => false };
|
|
36
|
+
window.OTB = { contributeHallWidget(w) { window.__widget = w; } };`;
|
|
37
|
+
|
|
38
|
+
async function boot({ game = true } = {}) {
|
|
39
|
+
const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 }, reducedMotion: 'reduce' });
|
|
40
|
+
const page = await ctx.newPage();
|
|
41
|
+
await page.setContent(`<!doctype html><html${game ? ' data-game="on"' : ''}><head><style>[hidden]{display:none!important}${pub('home-city.css')}</style></head><body>
|
|
42
|
+
<div class="page-head--hall">Hello</div><section id="home-city" class="scroll home-city" hidden></section>
|
|
43
|
+
<div id="zone-home-main" style="height:3000px">cards</div><footer class="app-foot">foot</footer></body></html>`);
|
|
44
|
+
await page.addScriptTag({ content: stubs });
|
|
45
|
+
for (const f of ['city-draw.js', 'home-city-draw.js', 'home-camera.js', 'home-city.js']) await page.addScriptTag({ content: pub(f) });
|
|
46
|
+
await page.evaluate(() => window.__widget.mount(document.getElementById('home-city')));
|
|
47
|
+
await page.waitForFunction(() => document.querySelector('.hc-svg').childNodes.length > 0);
|
|
48
|
+
return { ctx, page };
|
|
49
|
+
}
|
|
50
|
+
const shown = (page, sel) => page.evaluate((s) => { const e = document.querySelector(s); return !!e && getComputedStyle(e).display !== 'none'; }, sel);
|
|
51
|
+
const worldX = (page) => page.evaluate(() => Math.round(document.querySelector('.hc-svg').getBoundingClientRect().x));
|
|
52
|
+
const lastTl = (page, pick) => page.evaluate(pick);
|
|
53
|
+
|
|
54
|
+
test('game mode: the page is only the city, it cannot scroll, and the world is larger than the view', { skip }, async () => {
|
|
55
|
+
const { ctx, page } = await boot();
|
|
56
|
+
const s = await page.evaluate(() => {
|
|
57
|
+
const r = document.querySelector('.hc-svg').getBoundingClientRect(), h = document.documentElement;
|
|
58
|
+
window.scrollTo(0, 500);
|
|
59
|
+
return { world: h.classList.contains('hc-world'), overflow: getComputedStyle(h).overflowY, scrolled: window.scrollY, w: r.width, h: r.height, x: r.x, y: r.y };
|
|
60
|
+
});
|
|
61
|
+
const parts = {};
|
|
62
|
+
for (const sel of ['.page-head--hall', '#zone-home-main', '.app-foot', '.hc-ladder', '.hc-time', '.hc-svg']) parts[sel] = await shown(page, sel);
|
|
63
|
+
await ctx.close();
|
|
64
|
+
assert.equal(s.world, true);
|
|
65
|
+
assert.equal(s.overflow, 'hidden');
|
|
66
|
+
assert.equal(s.scrolled, 0, 'the page does not scroll');
|
|
67
|
+
assert.ok(s.w > 1280 && s.h > 800, 'the city is a world larger than the view');
|
|
68
|
+
assert.ok(s.x < 0 && s.y < 0, 'the view opens on the middle of it');
|
|
69
|
+
assert.deepEqual(parts, { '.page-head--hall': false, '#zone-home-main': false, '.app-foot': false, '.hc-ladder': false, '.hc-time': false, '.hc-svg': true });
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('game mode: the arrow keys move the city, and never past its edge', { skip }, async () => {
|
|
73
|
+
const { ctx, page } = await boot();
|
|
74
|
+
const start = await worldX(page);
|
|
75
|
+
await page.keyboard.down('ArrowRight');
|
|
76
|
+
await page.waitForFunction((x0) => Math.round(document.querySelector('.hc-svg').getBoundingClientRect().x) < x0 - 40, start);
|
|
77
|
+
await page.keyboard.up('ArrowRight');
|
|
78
|
+
await page.keyboard.down('ArrowLeft');
|
|
79
|
+
await page.waitForFunction(() => Math.round(document.querySelector('.hc-svg').getBoundingClientRect().x) === 0, null, { timeout: 15000 });
|
|
80
|
+
await page.waitForTimeout(200);
|
|
81
|
+
const end = await worldX(page);
|
|
82
|
+
const scrolled = await page.evaluate(() => window.scrollX + window.scrollY);
|
|
83
|
+
await page.keyboard.up('ArrowLeft');
|
|
84
|
+
await ctx.close();
|
|
85
|
+
assert.equal(end, 0, 'held against the left edge, the world stops at it');
|
|
86
|
+
assert.equal(scrolled, 0);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('game mode: time is on the visor; a drag sends the city back, and Home registers its rows, keys and the cursor sight', { skip }, async () => {
|
|
90
|
+
const { ctx, page } = await boot();
|
|
91
|
+
const read = () => lastTl(page, () => { const t = window.__tl[window.__tl.length - 1]; return { live: t.live, value: t.value, label: t.label, speed: t.speed, len: document.querySelector('.hc-svg').innerHTML.length }; });
|
|
92
|
+
const before = await read();
|
|
93
|
+
await page.evaluate(() => window.__tl[window.__tl.length - 1].seek(0.3));
|
|
94
|
+
const back = await read();
|
|
95
|
+
await page.evaluate(() => window.__tl[window.__tl.length - 1].faster());
|
|
96
|
+
const sped = (await read()).speed;
|
|
97
|
+
const scene = await page.evaluate(() => { const s = window.__visorScene; return { aim: s.aim, keys: s.keys.map((k) => k.key), rows: s.actions.map((a) => a.label) }; });
|
|
98
|
+
await page.evaluate(() => window.__tl[window.__tl.length - 1].toLive());
|
|
99
|
+
const live = (await read()).live;
|
|
100
|
+
await ctx.close();
|
|
101
|
+
assert.deepEqual([before.live, before.value, before.label, before.speed], [true, 1, 'Live', '1×']);
|
|
102
|
+
assert.equal(back.live, false);
|
|
103
|
+
assert.ok(Math.abs(back.value - 0.3) < 0.01 && back.label !== 'Live', 'the city is where the drag sent it: ' + back.label);
|
|
104
|
+
assert.notEqual(back.len, before.len, 'the city is redrawn for that week');
|
|
105
|
+
assert.equal(sped, '2×');
|
|
106
|
+
assert.equal(scene.aim, true);
|
|
107
|
+
assert.deepEqual(scene.keys, ['Arrows']);
|
|
108
|
+
assert.ok(scene.rows.includes('Play the city over time') && scene.rows.includes('Back to live') && scene.rows.some((r) => r.startsWith('Speed')), scene.rows.join(' | '));
|
|
109
|
+
assert.equal(live, true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('classic mode is as it was: the ladder, the slider and the cards are on the page, and no timeline is handed over', { skip }, async () => {
|
|
113
|
+
const { ctx, page } = await boot({ game: false });
|
|
114
|
+
const s = await page.evaluate(() => ({ world: document.documentElement.classList.contains('hc-world'), tl: window.__tl.filter(Boolean).length, aim: window.__visorScene.aim, transform: document.querySelector('.hc-svg').style.transform }));
|
|
115
|
+
const parts = { ladder: await shown(page, '.hc-ladder'), time: await shown(page, '.hc-time'), cards: await shown(page, '#zone-home-main') };
|
|
116
|
+
await ctx.close();
|
|
117
|
+
assert.deepEqual(s, { world: false, tl: 0, aim: false, transform: '' });
|
|
118
|
+
assert.deepEqual(parts, { ladder: true, time: true, cards: true });
|
|
119
|
+
});
|