SandboxModuleDef
Reference — SandboxModuleDef in the Mutka module API.
Interface: SandboxModuleDef<TCommandId>
Defined in: sandbox/authoring/defineModule.ts:11
Type Parameters
| Type Parameter | Default type |
|---|---|
TCommandId extends string | string |
Properties
author?
optional author?: ModuleAuthor;Defined in: sandbox/authoring/defineModule.ts:29
Who made this module - shown in the Modules UI. Source-agnostic: clicking the
name opens author.link (any http(s) URL - a personal site or a profile
page), and author.avatar is an http(s) URL or data:image/... avatar.
columns?
optional columns?: ColumnContribution[];Defined in: sandbox/authoring/defineModule.ts:53
Custom list-view columns. Each column declares declarative applicability (which directories it shows in, which items get a value) and its value is produced by a provider registered in setup via host.onColumn(id, handler).
commands?
optional commands?: SandboxCommand<TCommandId>[];Defined in: sandbox/authoring/defineModule.ts:37
Commands surfaced into the app's menus / toolbar. The literal ids here are
captured (via defineModule) and become the only values host.onCommand
accepts in setup.
description?
optional description?: string;Defined in: sandbox/authoring/defineModule.ts:16
discoverySources?
optional discoverySources?: DiscoverySourceDecl[];Defined in: sandbox/authoring/defineModule.ts:82
Module-discovery sources this module provides (e.g. a GitLab or local-folder
source). Declare { id, label } here, then in setup serve them with
host.onDiscover(id, …) and host.onFetchSource(id, …). The id appears in the
Modules "Browse" tab; results are validated + installed by the core. Gated by
the discovery permission (plus whatever the fetch needs, e.g. network:public).
fileIcons?
optional fileIcons?: FileIconContribution[];Defined in: sandbox/authoring/defineModule.ts:47
File-type icon overrides: ship your own logo (a base64 data:image/... URI) for a set of extensions, replacing the native macOS icon. Rendered via only, so it's injection-safe.
fileSystemProviders?
optional fileSystemProviders?: string[];Defined in: sandbox/authoring/defineModule.ts:74
URI schemes this module provides a virtual file system for (e.g. "nextcloud"). Register the handlers in setup with host.onList(scheme, …) / host.onOpenFile(…). Works in BOTH runtimes: built-ins call providers in-process; community modules serve each op over a worker round-trip. Note the worker realm has no DOM APIs (DOMParser, etc.), so providers needing those should ship as built-ins.
icon?
optional icon?: string;Defined in: sandbox/authoring/defineModule.ts:23
Card image for the Modules UI: an https:///http:// URL OR a
data:image/... URI (base64, e.g. data:image/png;base64,…, or URL-encoded
SVG). Rendered via only and scheme-checked, so it is
injection-safe; any other value is ignored.
id
id: string;Defined in: sandbox/authoring/defineModule.ts:13
Unique module id, "author.name" convention.
moduleManagerButtons?
optional moduleManagerButtons?: ModuleManagerButton[];Defined in: sandbox/authoring/defineModule.ts:88
Buttons to add to the Modules overlay (Browse tab). Declare { id, label, icon? }
and register the click handler with host.onUIEvent(id, …). Lets a module
surface an action there (e.g. an "Import local file" installer button).
name?
optional name?: string;Defined in: sandbox/authoring/defineModule.ts:14
openHandlers?
optional openHandlers?: SandboxOpenHandler[];Defined in: sandbox/authoring/defineModule.ts:39
Open handlers (double-click behavior) by item type.
panels?
optional panels?: PanelContribution[];Defined in: sandbox/authoring/defineModule.ts:60
Declarative side-pane panels. Each declares a tab (id/title/icon/side); fill
it from setup with host.ui.render(id, node) - a serializable UINode tree the
host renders natively. Buttons/lists/forms in the tree fire UI-event handlers
registered via host.onUIEvent(id, handler). Requires the ui permission.
permissions?
optional permissions?: ModulePermission[];Defined in: sandbox/authoring/defineModule.ts:33
Every privileged capability this module uses MUST be listed here.
settingsSections?
optional settingsSections?: SettingsSectionContribution[];Defined in: sandbox/authoring/defineModule.ts:66
Declarative settings sections shown inside the app's Settings panel. Same
model as panels: declare {id, title}, fill via host.ui.render(id, node).
Requires the ui permission.
setup?
optional setup?: (host) => void | Promise<void>;Defined in: sandbox/authoring/defineModule.ts:94
Runs once after load. Register command/open handlers and event subscriptions
here. Reaches the system only through host.* (each gated by permissions).
host.onCommand is typed to the commands[].ids declared above.
Parameters
| Parameter | Type |
|---|---|
host | SandboxHostApi<TCommandId> |
Returns
void | Promise<void>
sidebarItems?
optional sidebarItems?: SidebarItem[];Defined in: sandbox/authoring/defineModule.ts:41
Declarative entries in the left "Places" sidebar, grouped by category.
tags?
optional tags?: string[];Defined in: sandbox/authoring/defineModule.ts:31
Free-form tags for discovery filtering, e.g. ["files", "git", "viewer"].
version?
optional version?: string;Defined in: sandbox/authoring/defineModule.ts:15