Configuration Interface
Built to allow for dependency injection and modularity, the <SerpentaShell />
component takes a configuration prop which is set as context for all its children (recursively). Context in Svelte can be set by a parent component, and all the children nested within have access to it.
Interface
The config itself has the following interface:
Properties
Each of these properties can be accessed by calling the getSerpentaContext()
command within a component nested inside the <SerpentaShell>
one.
name | type | comments |
---|---|---|
|
| Interface for controlling the native app window. Used to make the custom title bar. |
|
| The name of the hyperloop pod. Used in the bottom bar. |
|
| The windowing engine interface, used to spawn a window e.g. containing a chart |
|
| Interface for invoking commands to the app backend. |
|
| A map of all charts used inside the Serpenta UI. |
|
| Store of a error status: 0 - safe, 1 - warning, 2 - unsafe. Used to light the shell for abnormal status. |
|
| The latest timestamp (the current moment) used to paint stale data. |
|
| The name of the command that sends a message/command to the pod itself. |
|
| The name of the store that holds the active state of the FSM. |
Usage within the UI kit
All Serpenta components shall get data that shall be configurable from this context by using the following:
You will have to use this component inside the <SerpentaShell />
parent component. When using SvelteKit, this can easily be done by wrapping the entire body of the app within this component inside the root +layout.svelte
route:
Now all inner pages will be loaded within the shell component because of the Svelte slots