NOTE: For now, this document applies to the refactor on the
BuildEnvkeeps track of the components involved in the Build->Render cycle. The cycle starts with a "root" component, on which a
Buildmethod is called, passing it a
BuildEnvinstance. This method returns the virtual DOM corresponding to this root component in its current state, and methods on BuildEnv are used to track the lifecycle of instances of child components.
Builderinterface has a single method
Buildwhich is implemented by a component and returns it's "virtual DOM" (represented by
Rendereris responsible for synchronizing a virtual DOM with its target output.
JSRendererperforms synchronization with the browser DOM. Where as
StaticHTMLRendererwill output the virtual DOM as a string for use in "server-side rendering", static website output, etc.
For something to be a "component" it is only required that it implements the
Builderinterface. References to child components are done statically in Go code. Likewise in .vugu files references to components correspond directly to package and struct names, there is no "registration" mechanism for components or any concept of components at runtime other than things that implement
Builderto generate virtual DOM and use the methods on
BuildEnvto manage lifecycle.
ParserGoPkgprovide the tooling to convert .vugu files or a directory with .vugu files (respectively) into components as described above.
Other tools layer on top of the basic ideas above.