Lavash.Overlay.RenderGenerator behaviour (Lavash v0.4.0-rc.3)

Copy Markdown View Source

Behaviour for overlay render generators.

Each overlay type (modal, flyover, etc.) implements this behaviour to generate its render/1 function. The component compiler calls the registered generator without needing to know the specifics of each overlay type.

Summary

Callbacks

Generates the render/1 function AST for the overlay component.

Returns the path to the helpers module that should trigger recompilation.

Callbacks

generate(module, dsl_state)

@callback generate(module :: module(), dsl_state :: map()) :: Macro.t()

Generates the render/1 function AST for the overlay component.

Receives the module being compiled and the DSL state, and returns quoted code that defines the render/1 function with the overlay chrome and content.

helpers_path()

@callback helpers_path() :: String.t()

Returns the path to the helpers module that should trigger recompilation.