refactoring

This commit is contained in:
2026-03-12 17:07:42 +01:00
parent 084863909a
commit e29c5d643c
11 changed files with 136 additions and 87 deletions

View File

@@ -13,15 +13,20 @@
*
* 3. **Display** — The Rendering node picks a view (image viewport vs markdown content)
* from `outputType` on the renderer and shows the result. Output menu items (e.g. Export)
* come from the source/renderer via `outputMenuDescriptor`.
* come from the source node descriptor's getOutputMenuContent (see NodeTypeDescriptor).
*
* ## Implementing a new source
* - Implement `IRenderingSource` (resolve + optional output menu).
* - Register with `registerSourceRenderingLogic(nodeType, logic)`.
* - Implement source rendering logic (resolve step) and set it on the node descriptor
* via .sourceRenderingLogic(). Optionally set .outputMenuContent() for the Output menu.
* - The descriptor is registered via registerNodeType(); source logic is registered automatically.
*
* ## Implementing a new output type
* - Add a config type (or equivalent) fulfilling `IOutputTypeRenderer`.
* - Register in CONFIG_TYPES and use `getConfigType(id)` in the resolve step.
*
* ## Shared helpers
* - templateRefs.ts: isReachable, resolveExtendsRef, getTemplateRefs (Nunjucks extends/include/import).
* Used by config resolve and the rendering node hook so template/reachability logic stays in one place.
*/
import type {
@@ -60,8 +65,7 @@ export interface IResolveResult {
/**
* Contract for a node type that can feed the Rendering node (config, agent, etc.).
* Register via registerSourceRenderingLogic(nodeType, logic).
* Output menu content is registered per output type in the frontend (outputMenuRegistry).
* Set on the node descriptor via .sourceRenderingLogic(); output menu via .outputMenuContent().
*/
export interface IRenderingSource {
/** When to re-run: 'auto' on upstream changes, 'manual' only on Run. */