Split the debug hook into one file per topic (#215)

debugHook.ts had grown to 1097 lines of unrelated test hooks. They
now live in seven files under src/editor/debug/, grouped by topic.
debugHook.ts only assembles them and is down to 86 lines.

- The shape of window.__gm is unchanged for tools/. Measured in the
  browser before and after: 120 top-level keys and 313 leaves with
  their arity, byte-identical JSON.
- The Text import is explicit in the helpers. Without it the name
  fell back to the DOM type and instanceof would never have matched.

Findings:
- The comment for vectorArt sat above pixelArt. It is back in place.
- An orphaned duplicate comment on assetRow is gone.

Tests:
- ./check.sh: 145 files, 2192 tests, CHECK EXIT 0 (unchanged)
- e2e 1-16,37,39-43,47,48: ALL PASSED, 734 checks
- The shape probe turns red against a deliberately misnested hook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-23 10:20:06 +02:00
1 parent b830f9c747
commit ed29b2f3dc
9 files changed
+1114 -1031

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import type { Application } from 'pixi.js';
import type { Editor } from '../Editor';
import type { SnapToggle } from '../graph/SnapToggle';
import type { EditorState } from '../state';
/** What every group of test hooks is built from. */
export interface HookContext {
app: Application;
state: EditorState;
editor: Editor;
}
export function centreOf(widget: { getGlobalPosition(): { x: number; y: number }; w: number; h: number }): {
x: number;
y: number;
} {
const p = widget.getGlobalPosition();
return { x: p.x + widget.w / 2, y: p.y + widget.h / 2 };
}
/** A tab's magnet (#194): where to click it, how big it is drawn, and whether it is on. */
export function snapButton(snap: SnapToggle): {
x: number;
y: number;
w: number;
h: number;
toggled: boolean;
} {
return {
...centreOf(snap.button),
w: snap.button.w,
h: snap.button.h,
toggled: snap.button.toggled,
};
}