import type React from 'react' export type NodeType = 'config' | 'render' | 'variable' | 'function' export type NodeHelpEntry = { title: string content: React.ReactNode } const Code = ({ children }: { children: React.ReactNode }) => ( {children} ) const Section = ({ title, children }: { title: string; children: React.ReactNode }) => (

{title}

{children}
) export const NODE_HELP: Record = { config: { title: 'Config node', content: ( <>

Config nodes hold PlantUML + Nunjucks template content. Connect one config to a Render node to display the diagram. Use the editor to write @startuml blocks and Nunjucks tags ({'{{ }}'}, {'{% %}'}).

From another config, reference this template:

Replace configId with this node’s id or its title. Connect variables/functions to this config; they are available as {'{{ varId }}'} and {'{{ x | fnId }}'} in the template.

), }, render: { title: 'Renderer node', content: ( <>

Connect a single Config node (input) to this Render node. It resolves the config’s PlantUML + Nunjucks (variables, function filters, extends/include), sends the result to the diagram service, and shows the SVG here.

Renderer nodes are terminal: they only consume configs. They are not referenced from other nodes. To reuse a diagram, reference the Config node from another Config (extends/include), then connect that config to a Render node.

), }, variable: { title: 'Variable node', content: ( <>

Variables hold a value (string, number, or boolean). Connect a Variable node to a Config node to expose it in that config’s template.

In a Config template connected to this variable, use {'{{ '}nodeId{' }}'} where nodeId is this node’s id. Example: if the variable node id is var_001, write {'{{ var_001 }}'} in the config.

), }, function: { title: 'Function node', content: ( <>

Functions are Nunjucks custom filters. Write a body using either named parameters (function(num, x, kwargs) { ... }) or the args array. Connect this node to a Config to use the filter in that config’s template.

In a Config template, use the filter syntax: {'{{ value | '}nodeId{' }}'} or {'{{ value | '}nodeId{'(arg1, key=val) }}'}. The first argument is the value before |; extra arguments and keyword args are passed as in Nunjucks. Return a value or a Promise for async filters.

), }, } export function getNodeHelp(nodeType: NodeType): NodeHelpEntry { return NODE_HELP[nodeType] ?? { title: nodeType, content: null } }