Remove exports and methods nothing uses any more
A reference search over every export and method in src/ found code that only tests still called, or that was never called at all: - RemoveSceneObjectCommand: the product only removes through the multi-object command; the tests now use that one too. - NodeRegistry.requireNodeDef: a second function of the same name in commands/require.ts raises a CommandError instead of throwing, and is the one the product uses. The twin invited the wrong import. - isTextureAsset, listContainers, AssetTabEditor.show, FocusManager.destroy, KeyboardBridge.selectAll and the getters ColorField.value, ListView.selected, NumberField.number. Also: Theme.controlActive now matches the resting control colour, and a new note asks what editing the graph during play would take. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0376ae175d
commit
495756b500
24 files changed
+22
-77
No files matched your search
@@ -62,10 +62,7 @@ export function requireNode(project: Project, assetId: string, nodeId: string):
|
||||
return node;
|
||||
}
|
||||
|
||||
/**
|
||||
* `NodeRegistry.requireNodeDef` throws a plain `Error`, which the editor does not catch; a command
|
||||
* needs a `CommandError` so an unknown type becomes a notice instead of a crash.
|
||||
*/
|
||||
/** A `CommandError`, so an unknown type becomes a notice instead of a crash. */
|
||||
export function requireNodeDef(type: string): NodeDef {
|
||||
const def = nodeDef(type);
|
||||
if (!def) throw new CommandError(`Unknown node type "${type}"`);
|
||||
|
||||
@@ -111,12 +111,6 @@ export class RemoveSceneObjectsCommand implements Command {
|
||||
}
|
||||
}
|
||||
|
||||
export class RemoveSceneObjectCommand extends RemoveSceneObjectsCommand {
|
||||
constructor(holderId: string, objectId: string) {
|
||||
super(holderId, [objectId]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The previous position is read at execution time, so a caller that previewed the move must
|
||||
* restore the model before executing.
|
||||
|
||||
@@ -111,12 +111,6 @@ export function nodeDef(type: string): NodeDef | undefined {
|
||||
return defs.get(type);
|
||||
}
|
||||
|
||||
export function requireNodeDef(type: string): NodeDef {
|
||||
const def = defs.get(type);
|
||||
if (!def) throw new Error(`Unknown node type "${type}"`);
|
||||
return def;
|
||||
}
|
||||
|
||||
export function allNodeDefs(): NodeDef[] {
|
||||
return [...defs.values()];
|
||||
}
|
||||
|
||||
@@ -86,7 +86,3 @@ export type Asset =
|
||||
export function isSceneAsset(asset: Asset): asset is SceneAsset {
|
||||
return asset.type === 'scene';
|
||||
}
|
||||
|
||||
export function isTextureAsset(asset: Asset): asset is TextureAsset {
|
||||
return asset.type === 'texture';
|
||||
}
|
||||
@@ -64,7 +64,3 @@ export function findObjectHolder(project: Project, holderId: string): ObjectHold
|
||||
const asset = findAsset(project, holderId);
|
||||
return asset && isObjectHolder(asset) ? asset : undefined;
|
||||
}
|
||||
|
||||
export function listContainers(project: Project): ContainerAsset[] {
|
||||
return project.assets.filter((a): a is ContainerAsset => a.type === 'container');
|
||||
}
|
||||
@@ -85,11 +85,6 @@ export abstract class AssetTabEditor<
|
||||
return this.canvas.currentAssetId;
|
||||
}
|
||||
|
||||
show(assetId: string): void {
|
||||
this.canvas.show(assetId);
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
/** The selection's id for this kind of asset, `''` when the selection is about something else. */
|
||||
protected abstract selectedId(): string;
|
||||
|
||||
|
||||
@@ -91,10 +91,6 @@ export class FocusManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destroy(): void {
|
||||
window.removeEventListener('keydown', this.onKeyDown);
|
||||
}
|
||||
}
|
||||
|
||||
function isAttached(node: Container, root: Container): boolean {
|
||||
|
||||
@@ -88,11 +88,6 @@ export class KeyboardBridge {
|
||||
if (document.activeElement === this.input) this.input.setSelectionRange(selectionStart, selectionEnd);
|
||||
}
|
||||
|
||||
/** The field learns about it through the usual `onBridgeInput` sync. */
|
||||
selectAll(): void {
|
||||
this.input.select();
|
||||
}
|
||||
|
||||
/** Ignored when another field attached meanwhile, so a late blur cannot steal it. */
|
||||
detach(target: TextEditTarget): void {
|
||||
if (this.target !== target) return;
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ export const Theme = {
|
||||
border: 0x383c46,
|
||||
control: 0x16181d,
|
||||
controlHover: 0x1e2127,
|
||||
controlActive: 0x2a2e37,
|
||||
controlActive: 0x16181d,
|
||||
accent: 0x4c8dff,
|
||||
accentText: 0xffffff,
|
||||
text: 0xe6e8ee,
|
||||
|
||||
@@ -57,11 +57,6 @@ export class ColorField extends Widget {
|
||||
this.addChild(this.row);
|
||||
}
|
||||
|
||||
/** The last valid color: an invalid hex being typed does not change it. */
|
||||
get value(): number {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
/** Model → view update: refreshes the hex text and an open picker without firing callbacks. */
|
||||
setValue(color: number): void {
|
||||
if (color === this.color) return;
|
||||
|
||||
@@ -92,10 +92,6 @@ export class ListView extends Widget {
|
||||
this.onPointerRelease(() => this.onDragEnd());
|
||||
}
|
||||
|
||||
get selected(): string | null {
|
||||
return this.selectedId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds all rows. The selection survives when its id is still present and is dropped
|
||||
* silently otherwise; highlights are kept as they are (the owner refreshes them).
|
||||
|
||||
@@ -85,11 +85,6 @@ export class NumberField extends TextField {
|
||||
});
|
||||
}
|
||||
|
||||
/** The clamped numeric value; while typing, the last valid parse of the text. */
|
||||
get number(): number {
|
||||
return this.numeric;
|
||||
}
|
||||
|
||||
/** The one place the value becomes text, so every path honours `decimals`. */
|
||||
private get display(): string {
|
||||
return formatNumber(this.numeric, this.decimals);
|
||||
|
||||
@@ -82,7 +82,7 @@ export function collectWorldItems(world: World): DrawList {
|
||||
props: e.props,
|
||||
parentId: e.parent?.objectId ?? '',
|
||||
enabled: true,
|
||||
// Resolved per frame on purpose: a behavior may swap `texture` with `Set property`.
|
||||
// Resolved per frame on purpose: a `Properties` node may swap `texture`.
|
||||
texture: e.type === 'sprite' ? resolveTexture(world.project, e.props) : null,
|
||||
}));
|
||||
return { items, background: world.backgroundColor };
|
||||
|
||||
Reference in new issue
Block a user