Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ a new game or a change keeps to them.
no Home page: the page reopens the game last in.
- **No notices from games.** `BOARD_KIT.say` does nothing; a board's title and the board
itself say what is going on. The field's own notices (`engineNotice`) are for errors.
- **The foot is draw's as it is now** (Dec 1, `docs/field.md`): the row has no plate, open or shut; a tile with a glyph (`statTiles`) is the glyph
alone and a chip is an icon, each saying its name in the popup over it (`#ringName`, `namesOnAsk`), so a new tile or chip gives a name (`value`,
`label`, `title`) and draws no word; the rings run to both ends of the foot (`RING_GONE`); and the dots in the upper left open and shut the row, or,
where an app has no row, put the toolbar away and bring it back (`body.bar-off`).
- **The buttons wear draw's look** (Nov 16, `docs/field.md`): a new chip, play-pad button or row tile takes the styles under DRAW'S BUTTONS
(`--dchip-*`, `--dgold`), not colours of its own.
- **Never a yaw of exactly 0** on a turned item (`BOARD_KIT.yawOf`): the field leaves it
Expand Down
20 changes: 20 additions & 0 deletions docs/field.md
Original file line number Diff line number Diff line change
Expand Up @@ -867,3 +867,23 @@ Four of smoke part 1's checks had been failing since the Nov 28 changes, on `mai
player's pace, past a double's 400 ms, and check the board did not go full screen; Sudoku's and Hashi's also wait past the check before's last
click, which landed on the same square 160 ms earlier and made a true double. Part 7's "double tap off default" now has Lights Out giving the
double click up. Each touch tap reaches the field once (checked: no tap is read twice by its pointer and touch events).

**The foot, as draw's and 3d's are now** (Dec 1: "do the same for games", after draw's "Show button in upper left to show hide", "Only show text on
the icons tooltip popup", "Remove the background from the footer", "The footer should use the full width, it is being clipped", and 3d's "also the
footer background should be transparent"). Four things, each where games already had half of it.
*The plate.* The row open had a tint, a blur and a rule along its top (shut, it had none since Sep 25). It has none open either (`#boardBrowser`):
the tiles are chips with their own fill and stand on the field.
*The words.* A tile of the row with a glyph (the chess editor's King and Queen, Play, FEN…; any `statTiles` entry with a `glyph`) carried its name
under the glyph and a label over it. `bbPaintStat` draws the glyph alone now, in the middle and larger; a tile with no glyph is its number or its
word and keeps it. The name is said in the one label the ring already had (`#ringName`), over the tile or the toolbar's chip, while the mouse is on
it or a finger is held on it, and for 1.2 s after the finger lifts (`namesOnAsk`; `window.__tileName()` for a check). A chip said its name only
while the ring turned, or in a title a finger never sees.
*The width.* The games toolbar's ring (`makeRing`) and the row's (`layoutBoardBrowser`) stopped a third short of each end: the chip farthest round
stood (n/2)/(H + n/2) of the way out and chips went out at 0.15 of their size. The horizon is moved out past the ends until the far side lands on
them, the focus's neighbours still a pitch apart (E(H + m)/(m(H + 1)) = pitch, m = n/2), and a chip is drawn down to 0.06 of its size (`RING_GONE`;
the row's own measure, a square root, 0.22 where it was 0.3). A ring of too few chips to reach (the block builder's five) stands as it did.
*The button.* The dots in the upper left open and shut the row. An app with no row but chips in the toolbar (the block builder, Air raid) had only the menu's Rings to put them away; the same dots, there, put the toolbar away and bring it back
(`body.bar-off`, `barHasChips`, `#bbHandle.bar`; gold while it shows, as they are while the row is open). With a row the dots are the row's, as before.
Probed in the block builder and chess at 1100 and 390 wide: the dots at (16, 16) toggled the toolbar; a chip pointed at said "Set red blocks"; the
row open had no plate, its tiles ran from edge to edge, the King's tile was the king alone and said "King". Part 1's dots check now allows the
dots where there is no row but a chip.
67 changes: 57 additions & 10 deletions games.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@
transparent when it's not expanded"): no tint, no blur, no rule along the
top — the field runs to the bottom of the screen, and only the chips and
the dots sit on it. Opening the drawer brings the glass back. */
/* OPEN, IT HAS NO PLATE EITHER (Dec 1: "do the same for games", after draw's "Remove the background from the footer" and 3d's "the footer
background should be transparent"): no tint, no blur, no rule; the tiles are chips with their own fill and stand on the field. */
#boardBrowser, body #boardBrowser { background: transparent; border-top-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
body.bb-collapsed #boardBrowser {
background: transparent; border-top-color: transparent;
-webkit-backdrop-filter: none; backdrop-filter: none;
Expand Down Expand Up @@ -1271,6 +1274,8 @@
/* (Nov 28: "When pinching or tap panning, hide the bottom toolbar.": the games toolbar's ring steps aside while two fingers pinch or a press
pans the view, `body.view-moving`, and comes back when the hand lets go) */
body.view-moving #gameBar, body.view-moving #ringName { visibility: hidden; }
body.bar-off #gameBar, body.bar-off #ringName { display: none !important; } /* (THE DOTS ARE THE TOOLBAR'S TOO, Dec 1) */
body:not(.bar-off) #bbHandle.bar svg circle { fill: rgba(232, 200, 106, .75); } body:not(.bar-off) #bbHandle.bar::before { border-color: rgba(232, 200, 106, .75); }
body.rings-off #yawZone, body.rings-off #tiltZone, body.rings-off #gameBar, body.rings-off #ringName { display: none !important; }
/* (Nov 28: "The font size of the rotate and tllt rings should match the readout on the bottom": the marks the size of #footStats's values, 1.375rem,
and a mark's room in the ring, `yawRingGeo`'s item, 60px from 50 so they do not crowd) */
Expand Down Expand Up @@ -13498,10 +13503,16 @@
if (!a) return true;
return !!(a.nativePieces || a._record || a.statTiles || a.statsFirst || a.quickActs || (a._list && a._list.length));
}
function barHasChips(){ const g = document.getElementById('gameBar'); return !!g && [...g.children].some(c => c.classList.contains('chip') && !c.hidden); }
function syncBrowserDots(){
const h = document.getElementById('bbHandle');
if (!h) return;
const want = bbHasRow() || document.body.classList.contains('game-running') ? '' : 'none'; // (the × to stop a game shows whatever the row: Nov 28)
/* THE DOTS ARE THE TOOLBAR'S TOO (Dec 1: "do the same for games", after draw's "Show button in upper left to show hide", of the bottom
toolbar). An app with a row has the dots to open and shut it. An app with no row but with chips in the games toolbar (the block builder's
colours, Air raid's weapons) had no way to put them away but the menu's Rings; the same dots, in the same corner, put its toolbar away and
bring it back (`body.bar-off`, gold while it shows, as they are while the row is open). */
const want = bbHasRow() || document.body.classList.contains('game-running') || barHasChips() ? '' : 'none'; // (the × to stop a game shows whatever the row: Nov 28)
h.classList.toggle('bar', !bbHasRow() && barHasChips());
if (h.style.display !== want) h.style.display = want;
}
function syncBrowserButton(){
Expand Down Expand Up @@ -13620,14 +13631,17 @@
size a step either side. Supersedes the VCP placement (one size, a tangent's spread) and Oct 8's even row for a row that fits. */
const _sc = {};
{ const fC = ((-bbAngle * n / Math.PI) % n + n) % n, pitch = BB_ITEM_W * BB_RING_PITCH;
const half = Math.max(pitch, halfWidth - pitch / 2), H = Math.max(1, half / pitch - 1), X = d => { const t = d / H; return t / (1 + Math.abs(t)) * half; }; // (RING_LINE.x, written here: the ring is declared further down)
let half = Math.max(pitch, halfWidth - pitch / 2), H = Math.max(1, half / pitch - 1);
// (THE RING USES THE WHOLE BAR, Dec 1, as the games toolbar's does: the horizon moved out until the tile farthest round stands at the row's end)
{ const m = n / 2, E = halfWidth - 6 - 0.2 * BB_ITEM_W; if (E > pitch * 1.05 && pitch * m > E * 1.02){ H = Math.max(0.25, m * (E - pitch) / (pitch * m - E)); half = E * (H + m) / m; } }
const X = d => { const t = d / H; return t / (1 + Math.abs(t)) * half; }; // (RING_LINE.x, written here: the ring is declared further down)
const near = Math.round(fC), reach = Math.min(Math.floor((n - 1) / 2) + 1, 400);
for (let j = -reach; j <= reach; j++){
const idx = (((near + j) % n) + n) % n; if (idx in best) continue;
let d = idx - fC; d -= Math.round(d / n) * n;
// (a tile is far wider than a ring's chip, so it shrinks as the square root of its room: the ring's own rate left three tiles a side, the outer ones specks)
const x = X(d), room = Math.min(X(d + 1) - x, x - X(d - 1)), shrink = Math.min(1, Math.sqrt(Math.max(0, room / pitch)));
if (shrink < 0.3) continue;
if (shrink < 0.22) continue; // (it was 0.3: the row stopped short of its ends, Dec 1)
best[idx] = x; _sc[idx] = shrink * (1 + (BB_RING_MAG - 1) * Math.max(0, 1 - Math.abs(d)));
}
}
Expand Down Expand Up @@ -13927,14 +13941,16 @@
tile with no label puts its glyph and name in the middle, with no empty line above them.) */
c.fillStyle = s.bg || '#1c1d21'; c.beginPath(); c.roundRect ? c.roundRect(0, 0, w, h, 6) : c.rect(0, 0, w, h); c.fill();
c.textAlign = 'center'; c.textBaseline = 'middle';
const lab = !!s.label;
const lab = !!s.label && !s.glyph;
if (lab){ c.fillStyle = '#c9ccd2'; c.font = '600 ' + Math.round(h * 0.13) + 'px ' + F; c.fillText(String(s.label), w / 2, h * 0.16, w - 8); }
const col = s.color || '#ffffff';
if (s.glyph){
c.fillStyle = col; c.font = Math.round(h * 0.34) + 'px ' + F;
c.fillText(s.glyph, w / 2, h * (lab ? 0.45 : 0.38));
c.fillStyle = '#ffffff'; c.font = '700 ' + Math.round(h * 0.2) + 'px ' + F;
c.fillText(String(s.value), w / 2, h * (lab ? 0.78 : 0.74), w - 8);
/* NO WORD ON AN ICON'S TILE (Dec 1: "do the same for games", after draw's "Text is still being shown on the icons in two different ways.
Only show text on the icons tooltip popup."). A tile with a glyph carried its name under it, and a label over it: the glyph alone now,
in the middle and larger, and the words in the popup over the tile while it is pointed at or held (THE ROW'S TILES AND THE BAR'S CHIPS
SAY THEIR NAMES). A tile with no glyph is its number or its word, and keeps it. */
c.fillStyle = col; c.font = Math.round(h * 0.46) + 'px ' + F;
c.fillText(s.glyph, w / 2, h * 0.52);
} else {
c.fillStyle = col; c.font = '700 ' + Math.round(h * (String(s.value).length > 5 ? 0.22 : 0.32)) + 'px ' + F;
c.fillText(String(s.value), w / 2, h * 0.5, w - 8);
Expand Down Expand Up @@ -14775,9 +14791,11 @@
h.addEventListener('click', e => {
e.stopPropagation();
{ const a = runApp(); if (a){ try { a.stopGame(); } catch {} try { window.fieldWake && window.fieldWake(); } catch {} return; } }
if (!bbHasRow() && barHasChips()){ const off = document.body.classList.toggle('bar-off'); h.title = off ? 'Show the bottom toolbar' : 'Hide the bottom toolbar'; try { window.fieldWake && window.fieldWake(); } catch {} return; } // (THE DOTS ARE THE TOOLBAR'S TOO)
toggleBoardBrowser();
syncBrowserVisibility();
});
setInterval(() => { try { syncBrowserDots(); } catch {} }, 400); // (the toolbar's chips come and go with the framed board)
})();
(function bbMountStrip(){
const strip = document.getElementById('boardBrowser');
Expand Down Expand Up @@ -70602,6 +70620,7 @@
the pitch. The demo: wander's ring.html; written up in wander's Reads and Writes §6 and essay 16 §10. */
const RING_LINE = { x: s => s / (1 + (s < 0 ? -s : s)), s: x => x / (1 - (x < 0 ? -x : x)) };
const RING_THROW_MS = 140, RING_FRICTION = 0.88, RING_V_MAX = 1.2, RING_V_MIN = 0.004, WHEEL_SPIN_GAIN = 0.3;
const RING_GONE = 0.06; // a chip is drawn down to this share of its size (it was 0.15, and the ring stopped a third short of each end: Dec 1)
function makeRing(strip){
if (!strip) return null;
const GAP = 16, RING_GAP_MIN = 4;
Expand All @@ -70628,13 +70647,20 @@
btns.forEach(b => { b.style.marginLeft = ''; });
strip.style.pointerEvents = 'auto';
wrapF(n);
const mid = W / 2, half = Math.max(ITEM, W / 2 - chipW / 2), H = Math.max(1, half / ITEM - 1); // the focus's neighbours a pitch apart: half/(H + 1) = ITEM
const mid = W / 2; let half = Math.max(ITEM, W / 2 - chipW / 2), H = Math.max(1, half / ITEM - 1); // the focus's neighbours a pitch apart: half/(H + 1) = ITEM
/* THE RING USES THE WHOLE BAR (Dec 1: "do the same for games", after draw's "The footer should use the full width, it is being clipped" and
3d's the same day). With the horizon at the bar's ends a ring of n chips never got there: the chip farthest round stood (n/2)/(H + n/2)
of the way out and the chips went out at 0.15 of their size before that, so a third of the bar stood empty at each end. The same line
from the same vantage, the horizon moved out past the ends until the far side of the ring lands on them: E is where the farthest chip
stands, and H is solved so it does with the focus's neighbours still a pitch apart (E(H + m)/(m(H + 1)) = ITEM, m = n/2). A bar too
narrow for that, or too few chips to reach, keeps the old reading. */
{ const m = n / 2, E = W / 2 - 6 - 0.2 * chipW; if (E > ITEM * 1.05 && ITEM * m > E * 1.02){ H = Math.max(0.25, m * (E - ITEM) / (ITEM * m - E)); half = E * (H + m) / m; } }
geo = { mid, half, H, n };
const X = d => RING_LINE.x(d / H) * half;
btns.forEach((b, k) => {
let d = k - f; d -= Math.round(d / n) * n; // the nearer way round: a count mod n
const x = X(d), room = Math.min(X(d + 1) - x, x - X(d - 1)), sc = Math.min(1, room / (chipW + 4));
if (sc < 0.15){ b.style.display = 'none'; b.style.scale = ''; return; }
if (sc < RING_GONE){ b.style.display = 'none'; b.style.scale = ''; return; }
b.style.display = ''; b.style.left = (mid + x) + 'px'; b.style.scale = sc < 0.999 ? String(sc) : '';
b.style.zIndex = String(40 + Math.round(sc * 60));
});
Expand Down Expand Up @@ -70734,6 +70760,27 @@
get said(){ return tip && tipFor && tip.classList.contains('on') ? tip.textContent : null; }, get shown(){ return items().filter(b => b.style.display !== 'none').length; } };
}
window.__gameRing = makeRing(document.getElementById('gameBar'));
/* THE ROW'S TILES AND THE BAR'S CHIPS SAY THEIR NAMES (Dec 1: "do the same for games", after draw's "Only show text on the icons tooltip
popup"). A chip of the games toolbar is an icon and said its name only while the ring turned (THE RING SAYS WHAT IS AT ITS FOCUS) or in a
title a finger never sees; an icon's tile in the row has no word on it now. So each says its name in the one label over it, the ring's
own (#ringName), while the mouse is on it or a finger is held on it, and for a moment after the finger lifts, so a tap shows it. */
(function namesOnAsk(){
let T = 0, tip = null;
const el = () => tip || (tip = document.getElementById('ringName')) || (() => { tip = document.createElement('div'); tip.id = 'ringName'; tip.setAttribute('aria-hidden', 'true'); document.body.appendChild(tip); return tip; })();
const nameOf = t => { if (t.classList.contains('bb-tile')){ const k = bbKeys[+t.dataset.idx] || ''; if (!k.startsWith('stat_')) return ''; const s = (_bbStatNow || [])[+k.slice(5)]; if (!s || !s.glyph) return '';
return [s.label, s.value].filter(x => x != null && String(x).trim()).join(': '); }
return t.title || t.getAttribute('aria-label') || ''; };
const say = t => { const said = nameOf(t); clearTimeout(T); const e = el(); if (!said){ e.classList.remove('on'); return; }
e.textContent = said; const r = t.getBoundingClientRect(), w = e.offsetWidth, h = e.offsetHeight;
e.style.left = Math.max(4, Math.min(innerWidth - w - 4, r.left + r.width / 2 - w / 2)) + 'px'; e.style.top = Math.max(4, r.top - h - 8) + 'px'; e.classList.add('on'); };
const hush = after => { clearTimeout(T); if (!tip) return; if (after) T = setTimeout(() => tip.classList.remove('on'), after); else tip.classList.remove('on'); };
const at = e => e.target && e.target.closest && e.target.closest('#gameBar > .chip, #boardBrowser .bb-tile');
document.addEventListener('pointerover', e => { if (e.pointerType !== 'mouse') return; const t = at(e); if (t) say(t); });
document.addEventListener('pointerout', e => { if (e.pointerType !== 'mouse') return; const t = at(e); if (t && !(e.relatedTarget && t.contains(e.relatedTarget))) hush(); });
document.addEventListener('pointerdown', e => { if (e.pointerType === 'mouse') return; const t = at(e); if (t) say(t); }, true);
window.addEventListener('pointerup', e => { if (e.pointerType !== 'mouse') hush(1200); });
window.__tileName = () => tip && tip.classList.contains('on') ? tip.textContent : '';
})();

/* ═══ Image viewer wiring ═════════════════════════════════════════════════
Loader UI for the gallery (menu button, file input, whole-window drop) and
Expand Down
2 changes: 1 addition & 1 deletion tests/part1.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ try {
const active = await page.evaluate(() => { const a = window.getFieldApp(); return a && (a.id || a.name); });
if (active !== id) failures.push(`[${id}] switching did not take: the active app is ${active}`);
// the three dots are on every game that has a row (Oct 9: "always show the triple dots on bottom"), and only there (Nov 7: "if an applicaiton does not have a bottom browser, remove the bottom button.")
const dots = await page.evaluate(() => { const h = document.getElementById('bbHandle'), r = h && h.getBoundingClientRect(), a = window.getFieldApp(), has = !!(a.nativePieces || a._record || a.statTiles || a.statsFirst || a.quickActs || (a._list && a._list.length)), shown = !!(h && h.style.display !== 'none'); return has ? shown : !shown; }); // (the app's own say: an open row hides the dots by the sheet, in place of the file's name)
const dots = await page.evaluate(() => { const h = document.getElementById('bbHandle'), r = h && h.getBoundingClientRect(), a = window.getFieldApp(), has = !!(a.nativePieces || a._record || a.statTiles || a.statsFirst || a.quickActs || (a._list && a._list.length)), shown = !!(h && h.style.display !== 'none'), bar = [...document.getElementById('gameBar').children].some(c => c.classList.contains('chip') && !c.hidden); return has ? shown : (bar ? true : !shown); }); // (Dec 1: with no row the dots are the toolbar's, where it has chips) // (the app's own say: an open row hides the dots by the sheet, in place of the file's name)
if (!dots) failures.push(`[${id}] the three dots are showing where there is no row, or missing where there is one`);
console.log(`${failures.length === before ? 'ok ' : 'FAIL'} ${id}`);
}
Expand Down