The composer's + menu of connectors and plugin commands, and the commands as cards on an empty screen.
Installation
Usage
import { PluginMenu } from "./ui/uicontext/components/kit/PluginMenu.ts"const Message = UiSchema.TaggedEnum({ PickedCommand: { plugin: Schema.String, command: Schema.String }, ToggledConnector: { id: Schema.String, included: Schema.Boolean }, ClickedManagePlugins: {},})// in the Composer's `tools` slot: connectors to include, and each plugin's commandsexport const AddToTask = (h: Html.H<typeof Message.Type>, mailIncluded: boolean) => PluginMenu(h, { plugins: [{ id: "finance", name: "Finance", commands: [{ name: "reconcile", description: "Match last month's invoices to payments" }] }], connectors: [{ id: "mail", name: "Mail", included: mailIncluded }], onCommand: (plugin, command) => Message.PickedCommand({ plugin, command }), onConnector: (id, included) => Message.ToggledConnector({ id, included }), onManage: Message.ClickedManagePlugins(), })API reference
PluginMenuView function
Options
| Name | Type | Description |
|---|---|---|
key | string | Names the menu among others in the same view |
pluginsrequired | Plugin[] | — |
connectorsrequired | MenuConnector[] | — |
onCommandrequired | (plugin: string, command: string) => Message | A command was picked, by plugin and name |
onConnectorrequired | (id: string, included: boolean) => Message | — |
onManage | Message | — |
onFiles | Message | — |
disabled | boolean | — |
CommandCardsView function
Options
| Name | Type | Description |
|---|---|---|
commandsrequired | ReadonlyArray<PluginCommand & { readonly plugin: string; readonly pluginName?: string }> | — |
onPickrequired | (plugin: string, command: string) => Message | — |
label | string | — |
style | Style | — |