Skip to main content

Module host

Module host 

Source
Expand description

The designer host: a child process of the IDE (yog designer-host) that loads a mod’s library built for this machine (yog designer-lib) and draws the mod’s custom .yui components through the same recording YogGfxApi the designer uses — the mod’s own yog-ui and build code, out of the IDE’s process, so a panicking/crashing/looping component (or a rebuilt library) costs a restart of the host, never the IDE.

Protocol: one JSON request per stdin line; one JSON answer per stdout line, prefixed with MARK (the mod’s code may print to stdout too).

  • {"cmd":"load","lib":…,"modRoot":…} → {"ok":true,"components":[…]}
  • {"cmd":"render","name":…,"props":[[k,v]…],"w":…,"h":…,"availW":…,"availH":…} → {"ok":true,"w":…,"h":…,"ops":[DrawOp…]} (drawn at the origin; w/h ≤ 0: natural size)
  • {"cmd":"png", …render…, "scale":4, "out":"x.png"} → the same, also rasterized into out (for checking a component from a shell)

Failures answer {"ok":false,"error":…}.

Structs§

ComponentInfo
One component as the mod describes it (describe).
Loaded
A loaded mod library.
PropInfo
RenderReq

Constants§

COMMAND
The CLI command that runs a host.
DESIGNER_ABI
The designer protocol version this host speaks (yog_ui::component::designer::ABI).
MARK
Starts every answer line on stdout.

Functions§

serve
yog designer-host: serves requests until stdin closes.