PluginDescriptor
PluginDescriptor<
Name,ID,Store,SharedStoreProvider,State,Actions,Object,Messages> =object
Defined in: core/src/plugins/types.ts:97
A descriptor for a Levl plugin.
This type is meant to group everything related to a Levl plugin under one place where all the attributes can be tested against all the types.
Many of the attributes here are specific to an Object that this plugin defines (ID, State, Store, Content, Page).
Note: At the moment, it’s still very much unstructured and more like “a bag of all things plugin” than a “plugin definition”. As Levl grows, this descriptor should evolve into a more intuitive structured format.
Type Parameters
Section titled “Type Parameters”Name extends string = any
The unique identifier of the plugin.
ID extends string = any
Type of the ID of Object.
Store extends object = any
Type of a store that keeps a set of Objects.
SharedStoreProvider
Section titled “SharedStoreProvider”SharedStoreProvider extends SharedStore<Store> = any
State extends object = any
Type of Object’s state.
Actions
Section titled “Actions”Actions extends PluginActions = any
Types of a set of actions that this plugin can run on the server.
Object
Section titled “Object”Object extends SharedObject<ID, State> = any
Type of Object itself
Messages
Section titled “Messages”Messages extends MessagesDescriptor = MessagesDescriptor
Types of a set of messages. Messages are like actions but are 2 way (can return data) and can be awaited.
TODO: messages should be renamed to actions and replace existing actions.
Properties
Section titled “Properties”actions?
Section titled “actions?”
optionalactions:Actions
Defined in: core/src/plugins/types.ts:157
A list of Actions.
Content()?
Section titled “Content()?”
optionalContent: (props) =>JSX.Element
Defined in: core/src/plugins/types.ts:141
A component that renders an Object. Shown in the side pane when the object is selected.
Parameters
Section titled “Parameters”Accessor<ID>
Returns
Section titled “Returns”JSX.Element
createDraft()?
Section titled “createDraft()?”
optionalcreateDraft: () =>ID
Defined in: core/src/plugins/types.ts:153
A function that creates and initializes a draft of Object, and return its ID.
Returns
Section titled “Returns”ID
optionalicon:Component
Defined in: core/src/plugins/types.ts:114
An icon for the plugin’s sidebar item.
messages?
Section titled “messages?”
optionalmessages:{ [messageKey in keyof Messages]: MessageHandler<Messages[messageKey]> }
Defined in: core/src/plugins/types.ts:135
Handlers for each message type.
readonlyname:Name
Defined in: core/src/plugins/types.ts:110
The name (unique identifier) of the plugin.
Object()?
Section titled “Object()?”
optionalObject: (…args) =>Object
Defined in: core/src/plugins/types.ts:149
The Object class.
Parameters
Section titled “Parameters”…any[]
Returns
Section titled “Returns”Object
Page()?
Section titled “Page()?”
optionalPage: (props) =>JSX.Element
Defined in: core/src/plugins/types.ts:145
A page of Objects. Shown when the sidebar item is active.
Parameters
Section titled “Parameters”object & RouteSectionProps<any>
Returns
Section titled “Returns”JSX.Element
store?
Section titled “store?”
optionalstore:object
Defined in: core/src/plugins/types.ts:118
Attributes related to Object’s store.
handler
Section titled “handler”handler:
SharedStoreType<Store>
The class of Object’s store.
init:
Store
The value Store should be initialized with.
loadSample()
Section titled “loadSample()”loadSample(
store):void
A function that’s called to initialize Store with sample data. Only used in Playground mode.
Parameters
Section titled “Parameters”StoreProvider
Returns
Section titled “Returns”void