Files
AEmotionStudio-ComfyUI-Magn…/web/info-panel/NodeSelector.js
T
Æmotion StudioandClaude Opus 5.5 4b06ee92bb Update the Inspector panel look, navigation and editing
Restyle the panel on ComfyUI palette tokens and drop the built-in themes.
Add a header with Back/Forward, Prev/Next, Focus, Lock and a searchable
Go to node picker, a subgraph/group breadcrumb, and simplified modes:
Follow glass or Float, plus Sticky, Follow selection and Lock to node
(replaces Hold).

Fix widget edits (step2 steps, INT/FLOAT, commit on Enter/blur, undo),
subgraph lookups, orphaned dropdown menus, global arrow-key capture,
the pop-out editor, and remove Google Fonts loading and dead code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:47:21 -08:00

45 lines
1.5 KiB
JavaScript

class NodeSelector {
/**
* Get all nodes from the graph.
*/
getAllNodes() {
var _a, _b;
return ((_b = (_a = app == null ? void 0 : app.canvas) == null ? void 0 : _a.graph) == null ? void 0 : _b._nodes) ?? [];
}
getEntries() {
return this.getAllNodes().map((n) => ({
id: n.id,
title: n.title || "Untitled",
type: n.type || "Unknown",
order: n.order ?? -1
}));
}
/**
* Get nodes sorted by execution order.
* Only includes nodes that have a valid execution order.
*/
getNodesSortedByExecOrder() {
return this.getEntries().filter((n) => n.order >= 0).sort((a, b) => a.order - b.order);
}
/**
* Get a node by its ID.
*/
getNodeById(id) {
var _a, _b;
return ((_b = (_a = app == null ? void 0 : app.canvas) == null ? void 0 : _a.graph) == null ? void 0 : _b.getNodeById(id)) ?? null;
}
/**
* Nodes whose title or type contains the query (any case), or whose id it names as `#id` or plainly.
* Sorted by execution order; nodes without one come last, by title.
*/
search(query) {
const q = query.trim().toLowerCase();
const idQuery = q.startsWith("#") ? q.slice(1) : null;
const rank = (n) => n.order < 0 ? Infinity : n.order;
return this.getEntries().filter((n) => idQuery !== null ? !idQuery || String(n.id) === idQuery : n.title.toLowerCase().includes(q) || n.type.toLowerCase().includes(q) || String(n.id) === q).sort((a, b) => rank(a) - rank(b) || a.title.localeCompare(b.title));
}
}
export {
NodeSelector
};