User management: signing in is required before anything is loaded, the sign-in screen is drawn in the same canvas (user name, password as bullets, Enter moves on and submits) and the editor is built only after it; the API gained auth/session, auth/login and auth/logout while every other route answers 401 without a session, projects carry an owner and a foreign one comes back as 404, accounts live in data/users.json with a password hash and sessions as files in data/sessions with a sliding 30 days, so a build under the open tab does not sign anybody out; Logout sits at the far right of the toolbar and, as asked in the issue, does not reload the page: Editor.dispose() takes the editor down while the canvas stays, which is why the autosave, the focus handlers, the window listeners of the tilemap panel, the shortcuts and the plugins all got a way back; the tools sign in as e2e (tools/lib/auth.mjs, password from GAME_MAKER_E2E_PASSWORD or the git-ignored data/e2e-password.txt) and the browser gets the same session by cookie, new e2e module 45 covers the screen, the wrong pair, the bullets, logout without a reload and signing in again, new unit tests for HttpAuthStore and for what a session leaves behind (#177)
game-maker / gate (push) Successful in 2m5s
game-maker / suite (push) Failing after 6m22s

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-20 12:50:52 +02:00
1 parent 60ea56a2ce
commit 8e4bb6e1f9
38 files changed
+1530 -139

No files matched your search

+22
View File
@@ -22,6 +22,20 @@ export class FocusManager {
return this.focusedWidget;
}
/**
* Registers a handler for keys nobody consumed and returns the call that takes it away again.
* Signing out tears the editor down while the page stays up (#177), so everything it registered
* here has to go with it – a handler left behind would keep typing into a dead editor.
*/
onGlobalKey(handler: (event: KeyboardEvent) => boolean): () => void {
return remover(this.globalHandlers, handler);
}
/** The same for "focus moved", used by panels that postpone work while a field is being typed in. */
onFocusChange(handler: () => void): () => void {
return remover(this.changeHandlers, handler);
}
focus(widget: Widget | null): void {
if (widget === this.focusedWidget) return;
const previous = this.focusedWidget;
@@ -93,6 +107,14 @@ export class FocusManager {
}
}
function remover<T>(list: T[], entry: T): () => void {
list.push(entry);
return () => {
const index = list.indexOf(entry);
if (index >= 0) list.splice(index, 1);
};
}
function isAttached(node: Container, root: Container): boolean {
let current: Container | null = node;
while (current) {
+15 -2
View File
@@ -19,8 +19,13 @@ export interface TextFieldOptions {
* semantics, unlike `onChange`, which also fires when a click elsewhere takes the focus.
*/
onSubmit?: (value: string) => void;
/** A password: drawn as bullets, and never on screen as itself. */
secret?: boolean;
}
/** What a masked field shows per character. */
const BULLET = '•';
/**
* Single-line text input drawn in the canvas. Keyboard handling is delegated to the
* KeyboardBridge while focused; this class only mirrors value, selection and caret.
@@ -42,6 +47,7 @@ export class TextField extends Widget implements TextEditTarget {
private blinkTimer = 0;
private dragSelecting = false;
placeholder: string;
private readonly secret: boolean;
onInput?: (value: string) => void;
onChange?: (value: string) => void;
onSubmit?: (value: string) => void;
@@ -53,6 +59,7 @@ export class TextField extends Widget implements TextEditTarget {
this.onInput = options.onInput;
this.onChange = options.onChange;
this.onSubmit = options.onSubmit;
this.secret = options.secret ?? false;
this.focusable = true;
this.cursor = 'text';
this.minHeight = Theme.controlHeight;
@@ -207,8 +214,14 @@ export class TextField extends Widget implements TextEditTarget {
if (ui().focus.focused === this) ui().focus.blur();
}
/** What the field puts on screen for `text`: the text itself, or one bullet per character. */
protected shown(text: string): string {
return this.secret ? BULLET.repeat(text.length) : text;
}
// Measured on what is drawn, so caret and selection of a masked field sit on the bullets.
private textWidth(text: string): number {
return CanvasTextMetrics.measureText(text, this.textNode.style).width;
return CanvasTextMetrics.measureText(this.shown(text), this.textNode.style).width;
}
/** Character index closest to a local x coordinate. */
@@ -258,7 +271,7 @@ export class TextField extends Widget implements TextEditTarget {
.rect(1, 1, this.w - 2, this.h - 2)
.fill(0xffffff);
this.textNode.text = this.valueText;
this.textNode.text = this.shown(this.valueText);
this.placeholderNode.text = this.valueText ? '' : this.placeholder;
// Horizontal scroll so the caret stays visible.