feat: replace browser dialogs with in-game naming screen + notifications

Remove prompt() and alert() calls that broke game immersion. Add:
- Pokemon-style naming screen with character grid + direct typing
- Canvas-rendered notification toasts (with fade-out animation)
- Both render on top of workshop AND world mode canvases
- Workshop keyboard handler yields to naming screen when active

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jose Luis
2026-03-20 17:36:31 +01:00
parent c6f5e19af5
commit 816a02aeb9
6 changed files with 267 additions and 36 deletions

View File

@@ -11,6 +11,7 @@ import { saveState, loadState, exportAsFile, importFromFile } from './saveLoad.j
import { enterComponentEditor, editComponentBlueprint, exitComponentEditor, updateComponentButtons, setResizeCallback } from './components.js';
import { getExampleList, loadExample } from './examples.js';
import { createBusFromCut } from './bus.js';
import { isNamingActive, handleNamingInput } from './world/inventory.js';
const PAN_SPEED = 40;
@@ -325,6 +326,13 @@ export function initEvents() {
const keysDown = new Set();
document.addEventListener('keydown', e => {
// In-game naming screen takes priority over circuit editor
if (isNamingActive()) {
e.preventDefault();
handleNamingInput(e.key);
return;
}
keysDown.add(e.key);
if (e.key === 'Delete' || e.key === 'Backspace') {