Two compilers that walk a graph the same way walk it through one emitter (#85)
Refactoring round two: the particle and shader compilers share emitGraph.ts (cycle detection, duplicate names, emit order) and keep only their rules. FontLibrary and TextureLibrary sit on FileLibrary (base URL, loading/failed bookkeeping, listeners); SoundLibrary keeps its own contract. The three Create*Command share ImportFileCommand, the three renames share RenameCommand - class names stay. bandBounds() in framing.ts and portNameField() in portSection.ts replace in-file clones, and three comments that told history now state the rule. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bf0be66c9d
commit
d3563897d8
16 files changed
+376
-379
No files matched your search
@@ -175,12 +175,7 @@ function buildPickedPortSection(
|
||||
for (const port of ports) {
|
||||
const toggle = writeToggle(host, assetId, node, port);
|
||||
if (custom) {
|
||||
const name = new TextField(port.key, {
|
||||
width: NAME_WIDTH,
|
||||
onChange: (next) =>
|
||||
host.state.execute(new RenamePortCommand(assetId, node.id, port.key, next.trim())),
|
||||
});
|
||||
portRow(host, assetId, node, port, name, toggle);
|
||||
portRow(host, assetId, node, port, portNameField(host, assetId, node, port), toggle);
|
||||
continue;
|
||||
}
|
||||
const def = choices.find((d) => d.key === port.key);
|
||||
@@ -236,13 +231,14 @@ export function buildPortSection(
|
||||
: 'No outputs yet. Every output added here becomes a result of running this behavior.',
|
||||
);
|
||||
|
||||
for (const port of ports) {
|
||||
const name = new TextField(port.key, {
|
||||
width: NAME_WIDTH,
|
||||
onChange: (next) => host.state.execute(new RenamePortCommand(assetId, node.id, port.key, next.trim())),
|
||||
});
|
||||
portRow(host, assetId, node, port, name);
|
||||
}
|
||||
for (const port of ports) portRow(host, assetId, node, port, portNameField(host, assetId, node, port));
|
||||
}
|
||||
|
||||
function portNameField(host: InspectorHost, assetId: string, node: GraphNode, port: DeclaredPort): TextField {
|
||||
return new TextField(port.key, {
|
||||
width: NAME_WIDTH,
|
||||
onChange: (next) => host.state.execute(new RenamePortCommand(assetId, node.id, port.key, next.trim())),
|
||||
});
|
||||
}
|
||||
|
||||
function writeToggle(host: InspectorHost, assetId: string, node: GraphNode, port: DeclaredPort): Widget[] {
|
||||
|
||||
Reference in new issue
Block a user