Skip to content

views.mount

Mounts a widget (a reference or inline code) into a view or as a floating panel; replaces an earlier mount of the same id (DMN-1275).

/** `views.mount` params (DMN-1275): exactly one of `widget` and `code`; `panel` excludes `view` and `place`. */
export type MountParams = {
/**
* The source of a component (TSX), a live widget kept in the daemon's data folder
* (`<data>/mounts/<workspaceId>/<id>/index.tsx`), never in the workspace.
*/
code?: string | null;
/**
* The mount id, a widget name (letters, digits, `_`, `-`, `.` not first): the node's `instance` prop, the panel
* id, and the folder `code` is written to.
*/
id: string;
/** Mount as a floating panel over every view (`panels.<id>`) instead. */
panel?: boolean;
/** Where in the view (default: the `side` tabs when the view has them, else the end). */
place?: MountPlace | null;
/** The widget's props; `instance` is always the mount id. */
props?: Record<string, unknown> | null;
/** The view to mount into (default: the default view); a new id creates a view showing only the widget. */
view?: string | null;
/** A widget reference (`./widgets/<name>`, `omfp:<name>`); a bare name means `./widgets/<name>`. */
widget?: string | null;
workspaceId: string;
};
/** `views.mount` and `views.mount_update` result (DMN-1275, AGT-062). */
export type Mounted = {
id: string;
/** Whether it is the floating panel `id`. */
panel: boolean;
/** The widget reference the node renders. */
reference: string;
/** Whether a node of this mount id existed before, or the mount's code folder did (its code was replaced). */
replaced: boolean;
/** The view showing it; `null` for a floating panel. */
view?: string | null;
};
/** Where `views.mount` puts a widget in a view (DMN-1275). */
export type MountPlace =
/** A tab of the view's `tabs` container whose `id` prop is `side`. */
| "side_tab"
/** A tab of the view's `tabs` container whose `id` prop is `main`, after the conversation. */
| "main_tab"
/** The end of the view's root container. */
| "end";